AWS Builder Center

Private S3 Access with VPC Endpoints

Designed a VPC architecture using a Gateway endpoint so an EC2 instance could reach S3 privately, removing public internet exposure for CLI/S3 traffic, enforced with bucket and endpoint policies.

I wanted to understand how to eliminate public internet exposure for AWS CLI and S3 traffic from an EC2 instance, so I built a VPC architecture using a Gateway Endpoint to route that traffic privately within AWS’s network instead of over the public internet.
The setup: an EC2 instance in a VPC, a Gateway Endpoint for S3, and a combination of S3 bucket policies and endpoint policies to enforce that only traffic coming through that specific endpoint was allowed to access the bucket at all.
After applying the policies, something broke. Legitimate traffic that should have worked was being silently blocked, no clear error pointing at the cause. I traced it back to a route-table misconfiguration, the routing wasn’t actually sending traffic through the endpoint the way I assumed it was, so the endpoint policy was correctly rejecting traffic that technically wasn’t coming from where it needed to.
The real lesson: security policy and network routing have to agree with each other. A tightly scoped policy means nothing if the underlying routing isn’t actually sending traffic the path you think it is, and these failures tend to be silent rather than loud, which makes them genuinely harder to debug than a straightforward access-denied error.
Small project, but it taught me more about how AWS networking actually behaves under the hood than any amount of reading would have. Also any advice to become a better builder would help!!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article