Interview Prep/Networking/Cloud networking: VPC, firewalls, NAT, VPN and proxies

After adding an S3 gateway endpoint, EC2 instances get `AccessDenied` on buckets they could read before.

IntermediateTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer

Likely causes → Traffic now goes through the endpoint, and either the endpoint policy is restrictive (only allows certain buckets), or the bucket policy uses aws:SourceIp conditions that no longer match (requests via a gateway endpoint carry private IPs, not the NAT EIP).

Diagnose →

aws ec2 describe-vpc-endpoints --vpc-endpoint-ids <vpce> --query 'VpcEndpoints[0].PolicyDocument'
aws s3api get-bucket-policy --bucket <bucket> --query Policy --output text | jq .

Fix → Allow the bucket in the endpoint policy, and replace aws:SourceIp conditions with aws:SourceVpce or aws:SourceVpc.

Prevent → Use aws:SourceVpce from the start for private-access buckets and test endpoint rollouts in one subnet first.

All Networking questions Roadmap: Networking for DevOps

More on Cloud networking: VPC, firewalls, NAT, VPN and proxies