Opscraft
Route 53 hosted zones · Lesson 3 of 8 · 6 min read

Private hosted zones

What they are

A private hosted zone holds records that are answered only to queries from VPCs associated with it — via the Route 53 Resolver in those VPCs. The internet can't see them.

Why use them:

  • Friendly internal names — orders-db.internal.example.com, kafka.prod.internal — instead of hardcoded IPs or long AWS endpoints.
  • Indirection: change the target (new RDS instance, new internal ALB, failover) without changing app config.
  • No leakage of internal topology to the public internet.
  • Split-horizon designs (below).

RDS failover already relies on DNS: apps use the RDS endpoint name, which AWS repoints to the new primary. A private zone CNAME (orders-db.internal.example.com → orders.cluster-abc.ap-south-1.rds.amazonaws.com) adds a stable, human-friendly layer on top.

Requirements for resolution

For an instance to resolve a private zone record, all of these must be true:

  1. The zone is associated with that instance's VPC (association is per VPC; one zone can be associated with many VPCs in many regions and accounts).
  2. The VPC has enableDnsSupport = true — without it, the Amazon-provided resolver doesn't work at all.
  3. The VPC has enableDnsHostnames = true — required for private hosted zones to work.
  4. The instance actually uses the Amazon-provided resolver — the VPC base +2 address (e.g. 10.0.0.2) or 169.254.169.253 — as set by the VPC's DHCP options set (AmazonProvidedDNS). If the DHCP options point to a custom DNS server (an AD domain controller, for example), that server must forward the right queries to the Route 53 Resolver.
resource "aws_vpc" "main" {
  cidr_block           = "10.20.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true
}
resource "aws_route53_zone" "internal" {
  name = "internal.example.com"
  vpc { vpc_id = aws_vpc.main.id }
  lifecycle { ignore_changes = [vpc] }   # if other associations are managed separately
}
Enlarge diagramZone associatedwith this VPCDNS support onenableDnsSupport =trueDNS hostnames onenableDnsHostnames= trueUses the VPCresolverbase + 2 or169.254.169.2531234
Figure 1. Four things must all be true for an instance to see a private hosted zone.
Swipe sideways to see all of it, or tap to open it full screen.

Cross-account association

Associating a private zone (account A) with a VPC in account B is a two-step handshake:

# In account A (owns the zone): authorise the VPC
aws route53 create-vpc-association-authorization \
  --hosted-zone-id Z0ABC --vpc VPCRegion=ap-south-1,VPCId=vpc-0b123
# In account B (owns the VPC): associate
aws route53 associate-vpc-with-hosted-zone \
  --hosted-zone-id Z0ABC --vpc VPCRegion=ap-south-1,VPCId=vpc-0b123
# Back in account A: clean up the authorisation
aws route53 delete-vpc-association-authorization --hosted-zone-id Z0ABC --vpc VPCRegion=ap-south-1,VPCId=vpc-0b123

(The console doesn't support cross-account association — CLI/API/Terraform only.) At scale, Route 53 Profiles are easier (see hybrid lesson).

Enlarge diagramAccount Aowns the zoneRoute 53Account Bowns the VPCauthorise vpc-0b123associate vpc-0b123 with the zoneVPC now resolves the private zonedelete the authorisation (tidy up)
Figure 2. Associating a private zone with another account's VPC is a handshake: the zone owner authorises, the VPC owner associates.
Swipe sideways to see all of it, or tap to open it full screen.

Resolution rules inside a VPC

  • Most specific zone wins: with example.com and dev.example.com private zones associated, api.dev.example.com is answered from dev.example.com.
  • No fallback: if a private zone example.com is associated and www.example.com isn't in it, the resolver returns NXDOMAIN — it does not fall back to the public zone. Copy needed public records into the private zone, or use a more specific private zone name (internal.example.com).
  • Private beats public: inside the VPC, the private zone answers for its namespace even if a public zone with the same name exists.
  • Records can be aliases to internal ALBs/NLBs, CNAMEs to RDS endpoints, A records to fixed IPs, etc. Routing policies (weighted, failover with CloudWatch-alarm health checks...) work in private zones too.
  • DNSSEC signing isn't supported for private zones.

Watch out: naming a private zone after a domain you don't own (say google.com or a partner's domain) silently overrides that real domain for everything in your VPC — your instances can no longer reach the real site. Use a domain you own (internal.example.com) or a reserved internal suffix.

Enlarge diagramEC2 in the VPCaskswww.example.comprivate zone example.comhas api, db… no wwwpublic zone example.comhas wwwNXDOMAINno fallbacknever consulted from inside
Figure 3. Inside a VPC, a private zone wins for its whole namespace. If a name is missing from it, the answer is NXDOMAIN; there is no fallback to the public zone.
Swipe sideways to see all of it, or tap to open it full screen.

Interface endpoints and private DNS

When you create an interface VPC endpoint (e.g. for Secrets Manager) with private DNS enabled, AWS creates a hidden private hosted zone so the service's normal hostname (secretsmanager.ap-south-1.amazonaws.com) resolves to the endpoint's private IPs inside the VPC. Apps need no config change. In multi-VPC setups with centralised endpoints, you create your own private zones for those names and share them.

Lambda, containers and other clients

Anything that uses the VPC resolver sees private zones: EC2, EKS pods (via CoreDNS), ECS tasks, Lambda functions attached to the VPC. A Lambda function not attached to a VPC uses AWS's public resolution and can't see private names — a classic "works in the pod, not in Lambda" puzzle.