Private connectivity

PrivateLink is half the answer. DNS is the other half.

What really happens at the network and DNS level when you "enable PrivateLink".

Kevin Keller · kevinkeller.org

Why it matters

Public endpoints widen the attack surface

  • Traffic crosses the public internet
  • The service has a public IP anyone can reach
  • Your VPC needs an internet gateway or NAT
  • DORA, NIS2 or PCI-DSS may prohibit public paths for sensitive data

What PrivateLink does

A private, one-way connection between VPCs

  1. The provider creates an endpoint service behind a Network Load Balancer
  2. You create an interface endpoint in your VPC
  3. AWS adds a network interface with a private IP from your subnet
  4. Traffic flows over the AWS backbone to the provider
  5. The provider cannot connect back into your VPC

The catch

Without private DNS, nothing changes

Even with PrivateLink configured, your app still resolves the public IP and bypasses the endpoint entirely.

Your application connects to a hostname, not to 10.0.1.47.

The fix

A private hosted zone always wins over public DNS

AWS maps the service hostname to your endpoint's private IP. Same hostname, same port, same certificate, no code changes.

Resolution order

How the VPC resolver decides

  1. Private hosted zones linked to the VPC: return the private IP
  2. Route 53 Resolver rules: forward to on-premises or custom DNS
  3. No match: forward to public DNS

On-premises apps need a Resolver inbound endpoint to get the private answer.

Across clouds

The same idea under three names

AWSAzureGCP
Private endpointInterface EndpointPrivate EndpointPSC Endpoint
DNSPrivate Hosted ZonePrivate DNS ZoneCloud DNS
Cross-regionNo, use peeringYesYes

Security considerations

A private path still needs controls

  • Endpoint policies: limit who can use it and for which resources
  • Security groups: only app subnets, only required ports
  • DNS leakage: watch flow logs and DNS query logs
  • Exfiltration: combine endpoint, bucket and SCP policies

Cost

~$15/month

for a typical two-AZ deployment, plus data processing

Interface endpoints cost about $0.01 per hour per AZ and $0.01 per GB in us-east-1. Often negligible next to the compliance value.

When to use it

Match the tool to the case

Use casePrivateLink?
SaaS from a regulated VPCYes
Compliance bans public pathsYes
Public API for customersNo
S3 from a VPCGateway endpoint, free
Cost-sensitive dev and testMaybe not

Takeaway

PrivateLink gives you a private IP. Private DNS makes your apps use it.

Read the full article

Kevin Keller · kevinkeller.org