Networking and Content Delivery · Topic 4 of 6
Route 53 DNS and Routing Policies
Configure Route 53 hosted zones, record types, alias records, routing policies, health checks, private zones and Resolver endpoints for hybrid DNS.
- 5 min
- Includes a diagram
- A hosted zone is public or private, and a private zone works only in associated VPCs.
- Alias records are free for AWS targets and allowed at the zone apex, and a CNAME is not allowed there.
- Weighted, latency, failover, geolocation, geoproximity, multivalue and IP based are the routing policies beyond simple.
What it is
The Domain Name System (DNS) turns names such as www.example.com into IP addresses. Amazon Route 53 is the AWS DNS service. It can register domains, host the DNS records for a domain, check the health of endpoints, and route users to the best endpoint.
A hosted zone holds the records for one domain. A public hosted zone answers queries from the internet, and a private hosted zone answers only for the VPCs you associate with it.
How it works
Record types
| Record | Use |
|---|---|
| A and AAAA | Name to an IPv4 or IPv6 address |
| CNAME | Name to another name (not allowed at the zone apex) |
| MX | Mail servers for the domain |
| TXT | Text values such as domain verification and email policy |
| NS and SOA | Created for the zone, list the name servers and zone details |
| Alias | Route 53 specific: points a name to an AWS resource |
An alias record can point to a CloudFront distribution, a load balancer, an API Gateway endpoint, an S3 website endpoint, a Global Accelerator and other AWS resources. Alias queries to AWS resources are not charged, and an alias can be used at the zone apex (example.com), where a CNAME is not allowed. Alias answers follow the target's address changes automatically.
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "www.example.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z0000000EXAMPLE",
"DNSName": "my-alb-123456.us-east-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
}
}
}]
}
This change batch is applied with aws route53 change-resource-record-sets --hosted-zone-id <zone> --change-batch file://change.json. The HostedZoneId inside the alias is the zone of the target service, not your own.
The TTL (time to live) tells resolvers how long they may cache an answer. Lower it before a planned change so updates spread faster.
Routing policies
| Policy | Behaviour | Typical use |
|---|---|---|
| Simple | One record, one or more values returned | Single resource |
| Weighted | Share traffic by weight | Gradual rollout, A/B testing |
| Latency | Send users to the Region with the lowest latency | Global performance |
| Failover | Primary while healthy, otherwise secondary | Active passive disaster recovery |
| Geolocation | Based on the user's location | Language, licensing, compliance |
| Geoproximity | Based on distance, with an adjustable bias | Shift load between Regions |
| Multivalue answer | Returns up to eight healthy records | Simple load spreading with health checks |
| IP based | Based on the client's network range | Route known networks to chosen endpoints |
Geolocation is about where the user is, and latency is about network speed. They can give different results, so read the wording of the question.
Health checks
Health checks probe an endpoint over HTTP, HTTPS or TCP, or watch a CloudWatch alarm, or combine other checks. Records linked to a health check are removed from answers when unhealthy.
Failover, weighted, latency, geolocation and multivalue records can use them. For an alias to an AWS resource, "evaluate target health" uses the resource's own health.
Private hosted zones
A private hosted zone resolves names only inside associated VPCs. The VPCs must have DNS support and DNS hostnames turned on. This is how you give internal names, such as db.internal.example.com, to private resources, and you can use the same name publicly and privately (split horizon DNS) with different answers.
Route 53 Resolver for hybrid DNS
Every VPC has a built in Amazon provided DNS resolver. For hybrid networks, Resolver endpoints extend it.
- Inbound endpoint: lets on premises servers send queries to Route 53 Resolver, to resolve AWS private names.
- Outbound endpoint: with forwarding rules, sends queries for chosen domains from the VPC to on premises DNS servers.
Domain registration
Route 53 can register and renew domains. If you register a domain elsewhere, point its name server records at the four name servers of your hosted zone.
"Same name at the zone apex pointing to a load balancer or CloudFront" needs an alias record, because a CNAME cannot be used at the apex.
What to remember for the exam
- A hosted zone is public or private, and a private zone works only in associated VPCs.
- Alias records are free for AWS targets and allowed at the zone apex, and a CNAME is not allowed there.
- Weighted, latency, failover, geolocation, geoproximity, multivalue and IP based are the routing policies beyond simple.
- Failover routing needs a health check on the primary.
- Health checks can probe endpoints, follow alarms, or combine other checks.
- Lower the TTL before a planned DNS change.
- Resolver inbound endpoints serve on premises to AWS queries, and outbound endpoints forward AWS to on premises.
- Private zones require DNS support and DNS hostnames on the VPC.
Common mistakes
Using a CNAME at the apex. It is not allowed. Use an alias record.
Mixing up geolocation and latency. Geolocation chooses by the user's country, latency by measured speed.
Forgetting the VPC association. A private zone does nothing for a VPC that is not associated with it.
Expecting changes to appear at once. Cached answers last for the TTL.
Pointing failover at an unchecked record. Without a health check the primary never counts as unhealthy.
If you register a domain elsewhere and change name servers to a new hosted zone, copy all existing records first, or services such as mail will stop working.
Check yourself
Answer these three.
Which record type can point example.com (the apex) to an ALB?
An alias record, because a CNAME is not allowed at the zone apex.
Which routing policy gives active passive failover?
Failover routing with a health check on the primary record.
How can on premises servers resolve names in a private hosted zone?
Through a Route 53 Resolver inbound endpoint that they send queries to.
Topic 4 of 6 in Networking and Content Delivery
Test yourself on Networking and Content Delivery
The full AWS SOA-C03 question bank has 850 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.