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
In a nutshell
  • 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.

UserbrowserasksResolverrecursive DNSqueriesRoute 53hosted zoneanswersIP addressof the endpoint

How it works

Record types

RecordUse
A and AAAAName to an IPv4 or IPv6 address
CNAMEName to another name (not allowed at the zone apex)
MXMail servers for the domain
TXTText values such as domain verification and email policy
NS and SOACreated for the zone, list the name servers and zone details
AliasRoute 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

PolicyBehaviourTypical use
SimpleOne record, one or more values returnedSingle resource
WeightedShare traffic by weightGradual rollout, A/B testing
LatencySend users to the Region with the lowest latencyGlobal performance
FailoverPrimary while healthy, otherwise secondaryActive passive disaster recovery
GeolocationBased on the user's locationLanguage, licensing, compliance
GeoproximityBased on distance, with an adjustable biasShift load between Regions
Multivalue answerReturns up to eight healthy recordsSimple load spreading with health checks
IP basedBased on the client's network rangeRoute 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

A VPC instance query for corp.example matches a forwarding rule and leaves through the Resolver outbound endpoint to the on premises DNS server, while an on premises server sends a query for an AWS private name to the Resolver inbound endpoint, which passes it to Route 53 Resolver. 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.
VPC instanceasks for corp.exampleresolver ruleOutbound endpointin VPCforwardsOn premises DNSanswers

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.

Exam tip

"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.

Watch out

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.