How do you make sure EC2 instances and Lambdas reach S3 and DynamoDB without going over the internet?
BeginnerScenarioCloud IAM and Compliance
Answer
Situation read → Traffic to AWS APIs via NAT goes over public endpoints. VPC endpoints keep it on the AWS network and let you add policies.
What I'd do →
- Create gateway endpoints for S3 and DynamoDB (free) and interface endpoints for others (ECR, STS, Secrets Manager).
- Add endpoint policies limiting access to your own buckets.
- Use bucket policies with
aws:SourceVpceto deny access not through the endpoint for sensitive buckets. - Bonus: lower NAT gateway data costs.
Why → Private paths reduce exposure and enable data perimeter controls.
Interview tip → Mention "data perimeter" (aws:ResourceOrgID, aws:PrincipalOrgID) as the bigger pattern.
More on Cloud IAM and Compliance
You find an IAM policy with `"Action": "*", "Resource": "*"` attached to an application role. How do you right-size it?BeginnerYour company has 40 AWS accounts with no central controls. How do you set up preventive guardrails?IntermediateGuardDuty reports `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`. What happened and what do you do?AdvancedYour company must pass SOC 2 Type II in six months. What does DevOps own, and how do you automate evidence?IntermediateA partner needs access to one S3 bucket in your account. How do you set up cross-account access safely?IntermediateSomeone logged in with the AWS root user last night. How do you react, and how should you have known?Beginner