How does EC2 service discovery work?
IntermediateConceptPrometheus Architecture
Answer
Prometheus calls the EC2 API (needs ec2:DescribeInstances, usually via an instance role) and creates targets on the private IP with a set port, exposing __meta_ec2_tag_<Name>, __meta_ec2_instance_id, __meta_ec2_availability_zone and so on.
- job_name: ec2-node
ec2_sd_configs:
- region: ap-south-1
port: 9100
filters:
- name: tag:monitoring
values: ["enabled"]
relabel_configs:
- source_labels: [__meta_ec2_tag_Name]
target_label: name
More on Prometheus Architecture
Describe the Prometheus architecture.BeginnerWhat does a basic prometheus.yml look like?BeginnerWhat is the `up` metric?BeginnerWhat are `job` and `instance` labels and where do they come from?BeginnerHow is the Prometheus TSDB organized on disk?AdvancedWhat is the WAL and why does Prometheus restart slowly sometimes?Advanced