Home > Software engineering >  Not able to connect to an S3 bucket using a gateway VPC endpoint
Not able to connect to an S3 bucket using a gateway VPC endpoint

Time:11-07

I’m using a gateway endpoint to connect to a S3 bucket from an EC2 instance in the default VPC. However, the connection isn't working.

I have checked the following configurations:

  • VPC DNS resolution to yes.

  • VPC route table table has access to Amazon S3 using the gateway VPC endpoint.

  • Security group outbound rules for EC2 permits all traffic on all ports.

  • VPC network ACL is permitting all traffic.

  • Bucket policy allows public access.

  • EC2 instance is attached to IAM role which is attached to S3FullAccess Policy.

  • Both bucket and EC2 are in us-east-2.

Error Details:

[ec2-user@ip-172-31-37-114 ~]$ aws s3 ls

Connect timeout on endpoint URL: "https://s3.amazonaws.com/"
[ec2-user@ip-172-31-37-114 ~]$

CodePudding user response:

Can you please explain why it is not working without it --region us-east-2?

It was working because you were using s3.amazonaws.com endpoint which is for us-east-1 region. Gateway VPC endpoints are regional, and your endpoint was created for us-east-2. So you had to explicitly tell aws s3 to use us-east-2, rather then default us-east-1.

  • Related