How do you lock down what can go through a VPC endpoint?
AdvancedProductionVPC and Network Design
Answer
Attach an endpoint policy. For S3, allow only buckets in your organization so a compromised host cannot exfiltrate to an attacker-owned bucket:
{
"Statement": [{
"Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "*",
"Condition": {"StringEquals": {"aws:ResourceOrgID": "o-abc123xyz"}}
}]
}
Add exceptions for AWS-owned buckets you need (for example Amazon Linux repos, ECR layer bucket). Pair it with bucket policies requiring aws:SourceVpce for sensitive buckets.
More on VPC and Network Design
Walk through a production VPC layout for a multi-tier app.BeginnerHow do you size VPC CIDRs to avoid painting yourself into a corner?IntermediateOne NAT gateway or one per AZ?BeginnerWhat are the biggest levers to reduce NAT gateway cost?IntermediateWhich VPC endpoints do you create by default in a private EKS or ECS VPC?IntermediateHub-and-spoke with Transit Gateway: how do you design route tables?Advanced