Reaching AWS Services Privately with VPC Endpoints and PrivateLink
This lesson explains how VPC endpoints let resources reach AWS and partner services privately, without internet gateways, NAT or public IP addresses.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish gateway endpoints from interface endpoints.
- Identify the endpoints that fully private subnets need.
- Explain how endpoint policies restrict access and how PrivateLink exposes services.
Endpoint types
VPC endpoints let resources in a VPC reach AWS services privately, without an internet gateway or NAT gateway, and they come in two types. A gateway endpoint is available only for S3 and DynamoDB. It is a target in the subnets' route tables, so traffic to the service's normal public names travels privately. It is free, which makes it the first choice for private access to those two services, but it works only for traffic originating inside the VPC; it cannot be used from on-premises networks or peered VPCs.
An interface endpoint, powered by AWS PrivateLink, is available for most AWS services, including S3. It creates network interfaces with private IP addresses in chosen subnets, and with private DNS enabled, the service's standard name resolves to them, so applications need no change. Because the endpoint is an address in the VPC, it can also be reached from on-premises networks over VPN or Direct Connect. It is charged per hour in each Availability Zone, plus per gigabyte. The following table summarises the differences.
The following diagram compares the path each endpoint type provides.

Gateway or interface endpoint?
Fully private subnets
In a subnet with no NAT gateway, nothing can reach the public AWS endpoints, so every service the workload calls needs its own VPC endpoint. A missing endpoint shows up as a call that times out. Session Manager, for example, needs three interface endpoints to manage an instance. Pulling container images from ECR needs the two ECR endpoints plus the S3 gateway endpoint, because image layers are stored in S3. Sending logs needs the CloudWatch Logs endpoint. The following table summarises these examples.
| Need | Endpoints |
|---|---|
| Session Manager | SSM, SSM Messages, EC2 Messages |
| Pulling container images | ECR api and dkr, plus the S3 gateway endpoint |
| Logging | CloudWatch Logs |
In multi-VPC networks, centralise interface endpoints in a shared services VPC reached through a transit gateway with Route 53 private hosted zones.
Calls that time out
Policies and endpoint services
Access through VPC endpoints can be restricted from both sides. Endpoint policies limit which resources can be reached through an endpoint, for example only the company's own S3 buckets, which prevents data from being copied to an outside bucket. Bucket policies can, in turn, require that requests arrive through a specific endpoint, using the aws:SourceVpce condition, so the bucket cannot be reached from anywhere else.
AWS PrivateLink can also expose a team's own service to other VPCs. An endpoint service, placed behind a Network Load Balancer or Gateway Load Balancer, is consumed through interface endpoints in other VPCs and accounts. Access is one-way, from consumer to service, needs no VPC peering, and works even when the VPCs' CIDR ranges overlap.
Endpoint policies
A VPC with no internet access at all
A regulated workload must run in subnets with no internet gateway or NAT gateway, yet its Lambda functions and EC2 instances use S3, DynamoDB, Secrets Manager, KMS and CloudWatch Logs.
| Service | Endpoint |
|---|---|
| Amazon S3 | Gateway endpoint (free) |
| Amazon DynamoDB | Gateway endpoint (free) |
| AWS Secrets Manager | Interface endpoint |
| AWS KMS | Interface endpoint |
| CloudWatch Logs | Interface endpoint |
An endpoint policy on the S3 endpoint allows access only to the company's own buckets, so data cannot be copied to an outside bucket even by compromised code. A partner's SaaS service is reached the same way, through an interface endpoint to the partner's PrivateLink endpoint service.
Which two services can use gateway endpoints?
Show answer
Amazon S3 and DynamoDB. Gateway endpoints add routes to the route table and have no extra charge; other services use interface endpoints.
Exam Tips
Remember for the exam
- For private access to S3 or DynamoDB at no cost, use a gateway endpoint.
- To access S3 privately from on premises, use an S3 interface endpoint.
- To expose a service privately to many consumer VPCs and accounts, use a PrivateLink endpoint service with an NLB.
- To lock a bucket to traffic from your endpoint, use an aws:SourceVpce condition.
- When private ECS tasks cannot pull images, add the ECR api and dkr interface endpoints and the S3 gateway endpoint.
- For Session Manager in subnets without internet, add the SSM, SSM Messages and EC2 Messages interface endpoints.