- Newest
- Most votes
- Most comments
Hi, such a ConnectionTimeout usually comes from the fact that the EC2 instance cannot access the S3 service endpoint. The issue then lies usually in the security group of the VPC where the EC2 instance resides: it must allow access to Internet for https (tcp port 443).
If your EC2 needs to be in a fully private VPC, you'll have to define a service endpoint for S3 in the VPC.: see https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html
Note: I'd suggest to get this code working on your laptop first before moving it to EC2. It reduces the number of potential config hiccups. When ok on your laptop, you can move it to EC2 and focus on the config of your resources.
Best,
Didier
Thanks for your response, I'll check the security group of the VPC. But do you have any idea why it works with the AWS CLI and not with the Java SDK? Does the AWS CLI performs some additional steps before making the list operation? The Java SDK works without the region parameter and I'm facing this issue only when I provide the region as us-east-2.
Relevant content
- asked 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Hi, you should paste full code (i.e. including your list request) to obtain efficient support. BTW, it seems that you're still using SDK v1. Why don't you switch to v2?
@Didier_Durand Added the code for listing the buckets. As for the v1 SDK, I was just trying out with this code and got an issue.