CloudWatch Agent ec2metadata not available

0

I have 3 EC2 instances which do not have a public IP address and are connected via a VPN to a private network. I have installed the CloudWatch agent on them. When I try to start them using the following command:

$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s

I receive the following error:
ec2metadata is not available
I! detect region from ecs
Unable to determine aws-region.
Please check if you can access the metadata service. For exampe, on linux, run 'wget -q -O - http://169.254.169.254/latest/meta-data/instance-id && echo'
Fail to fetch the config!

When I try to run the specified wget command I get a 503 Service Unavailable error.

I am at a loss for how to troubleshoot this further. Is there a way to specify the Region in the config files for the agent?

mhatch1
已提问 3 年前2329 查看次数
1 回答
0

Hello,

thank you for sending this message.

it's possible that this might be a metadata issue and not a region issue. I see that you are using VPN, so I suspect this instances needs to get access to ec2 endpoints.

Here is link that might be helpful : This should help https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html#CloudWatch-Agent-Configuration-File-Metricssection

Get back to us if you need anything.

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则