- job_name: 'ec2-sd'
proxy_url: '172.31.2.224:3001'
scrape_interval: 5s
ec2_sd_configs:
- region: cn-north-1
access_key: xxxxxxxxx
secret_key: xxxxxxxxx
port: 9100
relabel_configs:
- source_labels: ["__meta_ec2_tag_Usage"]
target_label: "usage"
error log:level=error ts=2021-01-05T05:05:37.883Z caller=refresh.go:95 component="discovery manager scrape" discovery=ec2 msg="Unable to refresh target groups" err="could not describe instances: RequestError: send request failed\ncaused by: Post https://ec2.cn-north-1.amazonaws.com.cn/: dial tcp 54.222.5.106:443: connect: connection timed out"
If you don't have access to the Internet from your Prometheus
server you probably need to add a VPC endpoint for the EC2 API
(https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html),
possibly also setting the endpoint in the EC2 SD configuration
(https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ec2_sd_config).