VPC Endpoints (Gateway vs Interface)
Part of the AWS Roadmap
In short
Private servers often talk to S3, Systems Manager or Secrets Manager. Without endpoints that traffic goes through a NAT gateway and out to public service addresses. VPC endpoints keep it private, safer and often cheaper.
VPC endpoints let resources reach AWS services privately without going through the internet or a NAT gateway. Gateway endpoints support only S3 and DynamoDB and work through route tables, while interface endpoints use AWS PrivateLink and create network interfaces in your subnets for many services.

Think of it like this
A private tunnel to the warehouse
Instead of trucks leaving your factory, joining the busy highway and coming back to a warehouse nearby, you dig a private tunnel straight between them. A gateway endpoint is a free tunnel for S3 and DynamoDB; an interface endpoint is a small private service counter built inside your own compound.
Watch it happen
Gateway endpoint vs interface endpoint
Gateway endpoint
- Only for Amazon S3 and DynamoDB
- Added as a target in route tables
- No hourly or data processing charge
- Works only from inside the VPC
Interface endpoint (PrivateLink)
- For many AWS services and partner services
- Creates network interfaces with private IPs in your subnets
- Charged per hour per AZ and per GB
- Reachable over VPN, Direct Connect and peering too
Always add the free S3 and DynamoDB gateway endpoints. Add interface endpoints for services your private instances use, like SSM, when there is no NAT or you want traffic fully private.
The big ideas
What you need to know
Cut NAT costs
S3 traffic through a gateway endpoint skips the NAT gateway's per-GB charge.
Endpoint policies
Attach a policy to the endpoint to allow only certain buckets or actions through it.
Private DNS
With private DNS on, the normal service name like ssm.ap-south-1.amazonaws.com resolves to the endpoint's private IPs.
Security groups on interface endpoints
Interface endpoints have security groups. Allow HTTPS (443) from your instances.
See it in code
Walk through the code
1VPC_ID=vpc-0123456789abcdef02 3# Gateway endpoint for S3, attached to the private route tables4aws ec2 create-vpc-endpoint --vpc-id "$VPC_ID" \5 --vpc-endpoint-type Gateway \6 --service-name com.amazonaws.ap-south-1.s3 \7 --route-table-ids rtb-0priv00000000000a rtb-0priv00000000000b8 9# Interface endpoint for Systems Manager in two private subnets10aws ec2 create-vpc-endpoint --vpc-id "$VPC_ID" \11 --vpc-endpoint-type Interface \12 --service-name com.amazonaws.ap-south-1.ssm \13 --subnet-ids subnet-0priv0000000000a1 subnet-0priv0000000000b1 \14 --security-group-ids sg-0endpoint00000000a \15 --private-dns-enabled1/3S3 traffic from subnets using these route tables now goes through the endpoint via a prefix list route.
A free S3 gateway endpoint for the private route tables, and a paid SSM interface endpoint in two AZs.
Save yourself the pain
Common mistakes
Oops
Creating a gateway endpoint and forgetting to pick the private route tables.
Do this instead
Gateway endpoints work through routes. Associate every route table whose subnets need S3.
Oops
Creating interface endpoints for every service 'just in case'.
Do this instead
Each one is billed per AZ per hour. Add only the ones your workloads use.
Your mission
S3 without the internet
Quick check
Which services can use a gateway VPC endpoint?
Go deeper
- 1Create an S3 gateway endpoint and access S3 from a private instance without a NAT gateway.
- 2Restrict a bucket policy to requests coming through that endpoint with aws:SourceVpce.
- 3Compare the cost model of gateway endpoints (no extra charge) and interface endpoints (hourly and per GB).
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.