Lesson 1 of 3 Amazon Route 53

Managing DNS with Route 53 Hosted Zones and Alias Records

This lesson explains Route 53, AWS's DNS service and domain registrar with a 100% availability SLA, and how hosted zones, records and alias records work.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish public and private hosted zones.
  • Choose between alias and CNAME records.
  • Explain how TTLs affect DNS changes.

Hosted zones

A hosted zone holds the DNS records for a domain, and it is either public or private. A public hosted zone answers queries from anywhere on the internet, so it holds the names customers use, such as www.example.com. A private hosted zone answers only queries from the VPCs associated with it, which must have DNS resolution and DNS hostnames enabled. It gives internal resources, such as databases, names that are invisible from outside. The following table summarises the two types.

ZoneAnswers
Public hosted zoneQueries from the internet
Private hosted zoneOnly associated VPCs (DNS hostnames and resolution enabled)

Same-named public and private zones give different answers inside and outside the VPC (split-horizon DNS), e.g. api.example.com resolving privately inside. Common records: A, AAAA, CNAME, MX, TXT, NS, SOA, CAA, SRV.

Alias records or CNAME

Both alias records and CNAME records point one name at another, but they behave differently. A CNAME record maps a name to any other host name, inside or outside AWS. DNS rules forbid a CNAME at the zone apex, the domain itself, so example.com cannot be a CNAME, and each query that Route 53 answers for it is charged.

An alias record is a Route 53 extension that points a name at an AWS resource, such as a load balancer, a CloudFront distribution, an API Gateway custom domain, an S3 website, a Global Accelerator, an interface endpoint or another record in the same zone. Route 53 resolves the target itself and returns its current IP addresses as an ordinary answer, so the record follows the target's address changes automatically. Alias records work at the zone apex, and queries for alias records that point to AWS resources are free. The following table summarises the differences.

Alias
TargetsELB, CloudFront, API Gateway, S3 websites, Global Accelerator, interface endpoints, other records in the zone
Zone apex (example.com)Yes
Follows target IP changesAutomatically
Query cost for AWS targetsFree
CNAME
TargetsAny host name
Zone apex (example.com)No
Follows target IP changesVia DNS
Query cost for AWS targetsCharged

The following diagram compares how the two record types resolve.

Alias records compared with CNAME records. An alias record for the zone apex, example.com, points at an AWS resource such as a load balancer; Route 53 resolves the target itself and returns its current IP addresses, and the query is free. A CNAME cannot exist at the apex, but can map a subdomain such as www.example.com to any host name, and its queries are charged.
Because Route 53 resolves an alias target itself, the record follows the load balancer's changing IP addresses without any update.
Sort into groups

Alias or CNAME?

Exam skills 3.5.3 · 3.4.1

Decide which record type each statement describes.

Log in to try this activity Interactive activities are free with an account.

TTLs and moving DNS

Each DNS record has a time to live (TTL), which sets how long resolvers may cache the answer. A long TTL reduces query volume and cost, but means that changes take that long to reach all clients, so the TTL is lowered well before a planned change, such as a migration, and raised again afterwards.

Route 53 can also register domains and supports DNSSEC signing, but domain registration and DNS hosting are separate: a domain registered elsewhere can be hosted in Route 53, and the reverse. To move DNS hosting to Route 53, a team creates a hosted zone, copies the existing records into it, lowers the TTLs, and then updates the name servers at the registrar to Route 53's.

Put in order

Moving DNS to Route 53

Exam skills 3.4.1

Put the steps of moving DNS hosting to Route 53 in order.

Log in to try this activity Interactive activities are free with an account.
Worked example

Pointing the apex domain at a load balancer

A company wants both example.com and www.example.com to reach its ALB. A CNAME record works for www, but the DNS standard does not allow a CNAME at the zone apex (example.com).

RecordTypeNotes
example.comAlias A record to the ALBAllowed at the apex; free queries; follows the ALB's IP changes
www.example.comAlias A record to the ALB (or a CNAME)Alias preferred: free and faster to resolve

Alias records are a Route 53 feature for AWS targets such as ALBs, CloudFront distributions, API Gateway and S3 website endpoints. Whenever a question involves the apex of a domain and an AWS resource, the answer is an alias record.

Check yourself

What is the difference between a public and a private hosted zone?

Show answer

A public hosted zone answers queries from the internet. A private hosted zone answers only queries from the VPCs associated with it.

Exam Tips

Remember for the exam

  • To point example.com, the zone apex, at a load balancer, use an alias record; a CNAME is not allowed at the apex.
  • For internal DNS names for resources in VPCs, use a private hosted zone.
  • Alias queries to AWS resources are free.
  • When the same name must resolve differently inside the VPC and on the internet, use public and private hosted zones (split horizon).
  • For a domain registered elsewhere, point its name servers to the Route 53 hosted zone.