Build VPC endpoint policies to restrict service access through interface and gateway endpoints.
Last verified: May 2026
Output will appear here...VPC endpoint policies control which AWS principals, actions, and resources can be accessed through a VPC interface or gateway endpoint. By default, endpoints allow full access to the target service, but custom policies can restrict this to specific S3 buckets, DynamoDB tables, or API actions — enforcing data perimeter controls that prevent data exfiltration even from compromised workloads. The VPC Endpoint Policy Builder helps you write policies with correct principal ARNs, action lists, resource constraints, and condition keys specific to each AWS service, generating policies that enforce least-privilege access through the endpoint.
Your security team needs to prevent a recurrence of last year's incident where a compromised EC2 instance copied 5 TB of customer data to an attacker-controlled S3 bucket. The builder generates an endpoint policy on the S3 gateway endpoint requiring aws:ResourceOrgID == your org ID. Combined with a bucket policy on customer data buckets requiring access via the specific endpoint, the architecture is now impossible to exfiltrate via legitimate AWS APIs from this VPC. Even compromised credentials can only reach buckets in your org through the endpoint.
S3 gateway endpoints are FREE — unlike interface endpoints which cost $0.01/hr per AZ + $0.01/GB processed. Always use a gateway endpoint for S3 (and DynamoDB) when possible. The naive 'use interface endpoint for everything' approach can add hundreds per month for no benefit.
Endpoint policies don't apply to traffic that doesn't transit the endpoint. If a workload reaches S3 via a NAT gateway + internet, the endpoint policy is silently bypassed. To enforce it, you also need bucket policies that require `aws:sourceVpce` matching the endpoint ID.
The aws:PrincipalOrgId condition is the killer pattern for data perimeter. Combined with endpoint policies that require this condition, you create an architecture where data CAN'T be exfiltrated to non-org S3 buckets even if a workload is fully compromised.
The builder constructs VPC endpoint policy JSON documents matching the IAM policy schema (Statement array with Effect, Principal, Action, Resource, Condition). Templates exist for common scenarios: org-scoped S3 access, ECR image pull restrictions, STS role assumption restrictions, KMS key isolation. Output is generated as JSON ready for the EndpointPolicyDocument parameter on aws ec2 modify-vpc-endpoint or in Terraform aws_vpc_endpoint.policy.
Was this tool helpful?
Disclaimer: This tool runs entirely in your browser. No data is sent to our servers. Always verify outputs before using them in production. AWS, Azure, and GCP are trademarks of their respective owners.