Configuring Route 53 Hosted Zones and Records
This lesson covers the Route 53 configuration elements that every other Route 53 feature builds on: public and private hosted zones, records, alias records and TTLs.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish public and private hosted zones and their name servers.
- Choose record types, including alias records.
- Plan TTLs before changes.
- Fix a domain that stopped resolving.
Public and private hosted zones
A public hosted zone contains records that answer queries from the internet for a domain such as example.com. Route 53 assigns four name servers to the zone, and the domain's registrar, whether Route 53 or another registrar, must list exactly those name servers in the NS records for the domain; a mismatch after recreating a zone is a classic reason why a domain stops resolving. A private hosted zone answers queries only from the VPCs associated with it. Those VPCs must have enableDnsSupport and enableDnsHostnames set to true. A private zone can be associated with VPCs in other accounts by authorising the association from the zone's account and completing it from the VPC's account. When a public and a private zone have the same name, queries from associated VPCs are answered by the private zone, a configuration called split-horizon DNS.
Record types and alias records
Common record types are A (IPv4), AAAA (IPv6), CNAME (maps a name to another name; not allowed at the zone apex), MX (mail), TXT (verification and SPF), NS and SOA (created automatically), CAA (which certificate authorities may issue certificates) and SRV. Route 53 adds the alias record, an extension that points to AWS resources: ELB load balancers, CloudFront distributions, S3 website endpoints, API Gateway, Global Accelerator, VPC interface endpoints and other records in the zone. Alias records can be created at the zone apex, track the target's IP addresses automatically, can evaluate target health, and are free to query for AWS targets.
| Requirement | Record |
|---|---|
| example.com (apex) to an ALB | Alias A record |
| www.example.com to a third-party host name | CNAME |
| Point to a CloudFront distribution | Alias A (and AAAA for IPv6) |
| Restrict which CAs can issue certificates | CAA |
Alias or CNAME?
TTL and propagation
The TTL (time to live) tells resolvers how long to cache an answer. A long TTL reduces query cost and latency but delays changes; before a planned migration, lower the TTL to 60 seconds a day in advance, make the change, then raise it again. Alias records use the TTL of the target AWS resource. Changes made in Route 53 propagate to its authoritative servers within about 60 seconds; the GetChange API reports INSYNC when they have.
TTL and changes
A domain that stopped resolving
An engineer deleted and recreated the public hosted zone for example.com with CloudFormation. All records were recreated, but the site no longer resolves on the internet, although dig @ns-123.awsdns-45.com example.com against the new name servers returns the right answer. The new zone received four different name servers, and the registrar still lists the old ones. Updating the domain's name servers at the registrar (route53domains update-domain-nameservers if registered with Route 53) fixes resolution once the TLD's NS TTL expires.
Which VPC settings does a private hosted zone need?
Show answer
enableDnsSupport and enableDnsHostnames on each associated VPC.
Exam Tips
Remember for the exam
- The registrar's name servers must match the hosted zone's four NS records.
- Private hosted zones need enableDnsSupport and enableDnsHostnames on associated VPCs.
- CNAME is not allowed at the apex; use an alias record for AWS resources.
- Lower TTLs before planned changes.