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:
- 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).
- The VPC has
enableDnsSupport = true— without it, the Amazon-provided resolver doesn't work at all. - The VPC has
enableDnsHostnames = true— required for private hosted zones to work. - 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
}
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).
Resolution rules inside a VPC
- Most specific zone wins: with
example.comanddev.example.comprivate zones associated,api.dev.example.comis answered fromdev.example.com. - No fallback: if a private zone
example.comis associated andwww.example.comisn'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.comor 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.
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.