- Newest
- Most votes
- Most comments
Hello.
Looking at the error message below, it appears that a timeout error has occurred when accessing "10.2.148.56:443".
I think "10.2.148.56" is a private IP address, but are you setting the CloudWatch Logs VPC endpoint etc. in the same VPC as EC2?
In that case, I recommend checking that the inbound rules for your VPC endpoint's security group allow HTTPS.
request send failed, Post "https://logs.us-east-2.amazonaws.com/": dial tcp 10.2.148.56:443: i/o timeout
Based on the information provided, it appears that your Docker container is unable to create a log stream in CloudWatch due to a network connectivity issue. Despite having the necessary IAM permissions and security group configurations, the container is experiencing a timeout when attempting to connect to the CloudWatch Logs endpoint.
Here are a few things to check and potential solutions:
-
VPC Configuration: Ensure that your EC2 instance is in a VPC with proper network configuration. The instance should have a route to the internet via an Internet Gateway or NAT Gateway.
-
DNS Resolution: Verify that DNS resolution is working correctly within your VPC. The error message shows an attempt to resolve "logs.us-east-2.amazonaws.com", which should translate to the correct IP address.
-
CloudWatch Logs VPC Endpoint: Consider setting up a VPC endpoint for CloudWatch Logs. This can improve connectivity and reduce latency, especially if your VPC has restricted internet access.
-
EC2 Instance Network Interface: Check if there are any issues with the network interface of your EC2 instance. Ensure it's correctly attached and functioning.
-
Proxy Settings: If your environment uses a proxy, make sure it's correctly configured for the Docker daemon and containers.
-
CloudWatch Agent: Although you're using the awslogs driver directly in Docker, you might want to try using the CloudWatch agent on the EC2 instance to see if it can successfully connect to CloudWatch Logs.
-
IAM Role Permissions: While you have "CloudWatchFullAccess", it's generally recommended to use more specific permissions. Ensure the role has the necessary permissions for creating log streams and putting log events.
-
Docker Network Mode: Check the network mode of your Docker container. Ensure it's not in a network mode that might interfere with its ability to reach external endpoints.
-
Firewall or Security Software: Check for any firewall rules or security software on the EC2 instance that might be blocking outbound connections to AWS services.
-
AWS Region: Confirm that the region specified in your logging configuration (us-east-2) matches the region where your EC2 instance is running.
The fact that you can successfully curl an external IP check service suggests that basic internet connectivity is working, but there might be specific issues related to reaching AWS service endpoints. Try running a similar curl command to the CloudWatch Logs endpoint to isolate whether it's a Docker-specific issue or a broader networking problem.
Sources
LogConfiguration - Amazon Elastic Container Service
Troubleshoot permission errors for an instance on CloudWatch | AWS re:Post
Did you increase IMDSv2 hop limit to 2?
From Instance metadata access consideration
In a container environment, set the hop limit to 2
The AWS SDKs use IMDSv2 calls by default. If the IMDSv2 call receives no response, the SDK retries the call and, if still unsuccessful, uses IMDSv1. This can result in a delay, especially in a container environment. In a container environment, if the hop limit is 1, the IMDSv2 response does not return because going to the container is considered an additional network hop. To avoid the process of falling back to IMDSv1 and the resultant delay, in a container environment we recommend that you set the hop limit to 2. For more information, see Configure the Instance Metadata Service options `
Relevant content
asked 2 years ago
asked 2 years ago
- AWS OFFICIALUpdated 6 months ago

I had to add an inbound rule in VPC endpoint's security group to allow HTTPS. Thanks!