Skip to content
advanced Phase 15 · AWS Advanced Networking

VPC Endpoints & PrivateLink

Access AWS services privately with VPC endpoints and PrivateLink.

45m
0 problems
Topic Progress 0%

Two Endpoint Types

Two Endpoint Types

VPC endpoints keep AWS service traffic off the public internet. Gateway endpoints (S3 and DynamoDB) are route-table targets: add a route, zero hourly cost, reachable only from within the VPC — the workhorse for S3 access from private subnets without a NAT box.

Interface endpoints are ENIs with private DNS names in your subnets, billed hourly per AZ plus data processed, and available for most AWS services plus anything exposed via PrivateLink: the provider puts their service behind a Network Load Balancer, creates an endpoint service, and consumers create interface endpoints to it — traffic never traverses the public internet, and the provider never sees the consumer's VPC.

Creating and Securing Endpoints

Creating and Securing Endpoints

aws ec2 create-vpc-endpoint --vpc-id vpc-abc \
  --service-name com.amazonaws.us-east-1.s3 \
  --route-table-ids rtb-123

aws ec2 create-vpc-endpoint --vpc-id vpc-abc \
  --vpc-endpoint-type Interface \
  --service-name com.amazonaws.us-east-1.secretsmanager \
  --subnet-ids subnet-1 subnet-2 \
  --security-group-ids sg-endpoint

An endpoint policy is an additional IAM-style resource policy on the connection (e.g., deny unless aws:sourceVpce matches). On the provider side, allow or deny specific AWS principals per endpoint. The SG attached to the endpoint ENIs must allow inbound 443 from the client subnets/CIDR.

Pitfalls and Interview Focus

Pitfalls and Interview Focus

DNS is the usual culprit: private DNS only works when the VPC has DNS resolution and DNS hostnames enabled; otherwise the public IP still resolves. Security groups are evaluated on both the client and the endpoint ENI — a correct client SG with a missing inbound rule on the endpoint yields timeouts.

S3 bucket policies can pin access with aws:sourceVpce, which breaks scripts that suddenly run from outside. Gateway endpoints apply only in their region and do not cover other services (NAT remains for those). Interface endpoints cost money per AZ, so use them where NAT egress or internet isolation matters.

Interview: contrast gateway (free, route-based, S3/DynamoDB) with interface (ENI, private DNS, hourly) and place PrivateLink as the cross-account service-sharing layer.

Quiz

1. Which services get gateway endpoints by default?

Question 1 options

2. An interface endpoint times out from the client. Most likely cause?

Question 2 options

3. What does PrivateLink give a service provider?

Question 3 options

Flashcards

Question

Gateway endpoint

Answer

Route-table target for S3/DynamoDB; free; no ENIs.

Question

Interface endpoint

Answer

ENIs + private DNS in your subnets; hourly per AZ + data processing.

Question

PrivateLink

Answer

Provider NLB + endpoint service; consumers attach interface endpoints privately.

Question

Endpoint policy

Answer

Extra resource policy on the endpoint (e.g., aws:sourceVpce conditions).

Question

Private DNS requirement

Answer

VPC must have enableDnsSupport and enableDnsHostnames turned on.

Revision Notes

Key Takeaways

  • 1. Gateway for S3/DynamoDB (free), interface for everything else
  • 2. Two security layers must both allow 443: client SG and endpoint SG
  • 3. PrivateLink is the pattern for cross-account private service exposure

Interview Tips

  • • Compare gateway vs interface endpoints with cost, scope, and mechanism in one breath
  • • Debug endpoint issues in order: DNS flags → SG both sides → endpoint policy → routing

Cheat Sheet

Gateway (S3/DynamoDB): route table, free. Interface: ENIs + private DNS, hourly/AZ. PrivateLink: NLB + endpoint service for cross-account. Check DNS support/hostnames, SG 443 both sides.

Continue Learning