Interview Prep/AWS/VPC and Networking

How do you restrict an S3 bucket so it is reachable only from your VPC?

IntermediateScenarioVPC and Networking
Answer

Situation read → Combine a gateway endpoint with a bucket policy condition.

What I'd do →

  1. Add a Deny statement with StringNotEquals on aws:SourceVpce equal to vpce-0abc
  2. Keep an exception for admin roles or the console flow
  3. Test from inside and outside the VPC
  4. Don't lock out CloudFormation or other AWS service principals

Why → A deny-unless-endpoint policy blocks leaked credentials used from outside.

Interview tip → Mention the risk of locking out yourself; test with a break-glass role.

aws All AWS questions Roadmap: AWS core services

More on VPC and Networking