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 年前檢視次數 2331 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南