# VPC Endpoints and PrivateLink

> Reach S3, DynamoDB and other AWS services privately from your VPC without a NAT Gateway, and expose your own services through PrivateLink. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/cloud-engineer/vpc-endpoints
Last updated: 2026-11-28

Reach S3, DynamoDB and other AWS services privately from your VPC without a NAT Gateway, and expose your own services through PrivateLink.

Intermediate · about 3 hours · difficulty 3/5

Learn first: [NAT Gateways, Security Groups and NACLs](https://www.internhack.in/roadmaps/tracks/cloud-engineer/nat-security-groups)

By default, a private instance calling S3 goes out through a NAT Gateway to the public S3 endpoint. That costs NAT processing fees and sends traffic over a public path. **VPC endpoints** fix both.

### Gateway endpoints

- Available for **S3 and DynamoDB** only.
- Added as a route in your route tables.
- **Free**. Every VPC that uses S3 heavily should have one.

### Interface endpoints (PrivateLink)

- Create an elastic network interface with a private IP in your subnets for services like Secrets Manager, ECR, CloudWatch Logs, SSM and STS.
- Private DNS makes the normal service hostname resolve to the private IP, so code does not change.
- Charged per hour per AZ plus per GB, so add them deliberately.

### Endpoint policies

Attach a policy to the endpoint to restrict which buckets or actions are reachable through it, and use aws:SourceVpce in bucket policies to accept traffic only from your endpoint. This is a strong data-exfiltration control.

### Exposing your own services

With **PrivateLink** you can publish a service behind a Network Load Balancer and let other VPCs or customers consume it through an interface endpoint, without peering or overlapping-CIDR worries. Azure Private Link and GCP Private Service Connect are the equivalents.

### Pitfalls

- Fully private subnets (no NAT) where ECS cannot pull images because ECR, S3 and logs endpoints are missing.
- Forgetting to enable private DNS on interface endpoints.

You are ready to move on when you can run an instance in a subnet with no internet route that still reads from S3 and fetches a secret.

## Key concepts

- **Gateway endpoints (S3, DynamoDB)**
- **Interface endpoints**
- **Private DNS for endpoints**
- **Endpoint policies**
- **aws:SourceVpce in bucket policies**
- **Publishing services with PrivateLink**

## Mini project

Add a free S3 gateway endpoint to a private subnet with no NAT, attach an instance role, and prove that aws s3 ls works while curl to a public website fails. Use a free-tier instance and Session Manager; terminate it and delete the VPC afterwards.

## Check yourself

Which two AWS services support free gateway endpoints, and why do they save money compared with a NAT Gateway?

## Free resources

- [AWS PrivateLink and VPC endpoints](https://docs.aws.amazon.com/vpc/latest/privatelink/what-is-privatelink.html) (AWS)
- [Gateway endpoints](https://docs.aws.amazon.com/vpc/latest/privatelink/gateway-endpoints.html) (AWS)

Previous: [VPC Peering, Transit Gateway and Hybrid Connectivity](https://www.internhack.in/roadmaps/tracks/cloud-engineer/vpc-connectivity) · Next: [Route 53 and CloudFront at the Edge](https://www.internhack.in/roadmaps/tracks/cloud-engineer/route53-cloudfront)

## More in VPC Networking

- [VPC, Subnets, Route Tables and Internet Gateways](https://www.internhack.in/roadmaps/tracks/cloud-engineer/vpc-basics)
- [NAT Gateways, Security Groups and NACLs](https://www.internhack.in/roadmaps/tracks/cloud-engineer/nat-security-groups)
- [VPC Peering, Transit Gateway and Hybrid Connectivity](https://www.internhack.in/roadmaps/tracks/cloud-engineer/vpc-connectivity)
- [VPC Endpoints and PrivateLink](https://www.internhack.in/roadmaps/tracks/cloud-engineer/vpc-endpoints)
- [Route 53 and CloudFront at the Edge](https://www.internhack.in/roadmaps/tracks/cloud-engineer/route53-cloudfront)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Cloud Engineer (AWS) Roadmap](https://www.internhack.in/roadmaps/tracks/cloud-engineer)
