- Newest
- Most votes
- Most comments
Hello Cuong,
I'm understanding your scenario as below, please correct me if I'm wrong.
- Ec2 instance in a private subnet, that does not have access to the Internet.
- You want to push Memory(Ram usage) metrics to CloudWatch
- You have created VPC Endpoint for CloudWatch Logs
Based on above information, it seems that you are not using the correct VPC Endpoint. To push metrics you need VPC Endpoint for CloudWatch service not CloudWatch Logs, on the contrary you will need VPC Interface Endpoint for CloudWatch Logs to push logs from Private EC2 instance with CW Agent. You can have details from [1] for endpoint_override configuration for Metrics section and [2] for VPC Endpoint for CloudWatch.
In addition to above, when pushing metrics from EC2 instance - EC2 instances needs to connect to EC2 service to obtain the EC2 tags initially. For this purpose you will also need to have VPC Interface endpoint for EC2 service as well. This can be seen from the error that you are observing:
2022-02-09T08:04:01Z W! processors.ec2tagger ec2tagger: Unable to describe ec2 tags for initial retrieval: RequestError: send request failed caused by: Post "https://ec2.ap-southeast-1.amazonaws.com/": dial tcp 52.95.35.53:443: connect: connection timed out
and make sure the EC2 instance's associated IAM Role/Instance Profile has the required permissions as described [3]. Precisely for above error, the required permission is "ec2:DescribeTags".
Hope this helps. Looking forward to your feedback.
Thanks
Relevant content
- asked a year ago
- asked 3 months ago
- Accepted Answerasked 4 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 12 days ago