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
asked 3 years ago2303 views
1 Answer
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.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions