Route 53 Policies

Difficulty: Advanced

Question

Explain the Amazon Route 53 routing policies. Pick three and describe a real use case for each.

Answer

Route 53 routing policies decide which answer a DNS query gets when a record name has more than one possible target. The main ones are simple, weighted, latency, failover, geolocation, geoproximity, IP-based, and multivalue answer. Three you should be able to explain cold are latency-based (send users to the fastest Region), failover (active-passive disaster recovery driven by health checks), and weighted (split traffic by percentage, for example a 5% canary release).

All policies at a glance

PolicyWhat decides the answerTypical use
SimpleOne record, no logicA single web server or ALB
WeightedRelative weights you assignCanary releases, A/B tests, gradual migration
LatencyLowest measured latency from the user's network to an AWS RegionMulti-Region apps
FailoverHealth check on the primaryActive-passive DR
GeolocationUser's continent, country, or stateCompliance, localised content
GeoproximityDistance to resources, adjustable with a biasShifting traffic between regions by location
IP-basedThe resolver's or client's CIDR blockRouting specific ISPs or networks
Multivalue answerUp to 8 healthy records returned at randomSimple client-side load spreading

1. Latency-based routing

You create records with the same name in, say, ap-south-1 (Mumbai) and eu-west-1 (Ireland). Route 53 uses AWS's latency measurements between networks and Regions to return the record with the lowest latency for that user. An Indian user typically gets Mumbai, a German user gets Ireland. Note this is latency, not geography: a user near a border may get the "farther" Region if the network path is faster.

2. Failover routing

You mark one record primary and attach a health check, and another secondary (often a static S3 maintenance page or a standby Region). While the primary is healthy, everyone gets it. When the health check fails, Route 53 starts answering with the secondary. Recovery time depends on the health check interval and failure threshold plus the record TTL, because resolvers cache the old answer until TTL expires. Keep TTLs low (60 seconds) on failover records.

3. Weighted routing

Each record gets a weight from 0 to 255, and traffic is split proportionally. Weights of 95 and 5 send roughly 5% of DNS answers to the new version. Setting a weight to 0 takes a target out of rotation without deleting it. Because clients and resolvers cache DNS, the split is approximate; for precise percentages per request, use ALB weighted target groups instead.

Combining policies, alias records, and gotchas

Real setups nest them. For example: latency routing chooses the Region, and inside each Region a failover or weighted record chooses between a primary and backup. Alias records let you point at ALBs, CloudFront, or S3 websites at the zone apex (example.com), which a CNAME cannot do, and alias queries to AWS resources are free.

A few gotchas:

  • Health checks are optional on most policies but required for meaningful failover. Without them Route 53 never knows a target is down.
  • Geolocation needs a default record, or users from unmatched locations get no answer.
  • DNS changes are never instant for users, because of TTL caching in resolvers and browsers.
Failover routing when the primary goes down. Route 53 keeps answering with the primary until its health check fails, then switches to the secondary.
  1. Route 53 → Primary (Mumbai): Health check every 30 s: healthy
  2. User resolver → Route 53: Query api.example.com
  3. Route 53 → User resolver: Answer: primary ALB
  4. Route 53 → Primary (Mumbai): Health checks fail 3 times
  5. User resolver → Route 53: Query again after TTL expires
  6. Route 53 → User resolver: Answer: secondary ALB
  7. User resolver → Secondary (Singapore): Traffic now served by standby

Code examples

Weighted records for a 95/5 canary split

{
  "Comment": "Canary 5% to v2",
  "Changes": [
    {
      "Action": "UPSERT",
      "ResourceRecordSet": {
        "Name": "api.example.com", "Type": "CNAME", "TTL": 60,
        "SetIdentifier": "v1", "Weight": 95,
        "ResourceRecords": [{ "Value": "v1-alb.ap-south-1.elb.amazonaws.com" }]
      }
    },
    {
      "Action": "UPSERT",
      "ResourceRecordSet": {
        "Name": "api.example.com", "Type": "CNAME", "TTL": 60,
        "SetIdentifier": "v2", "Weight": 5,
        "ResourceRecords": [{ "Value": "v2-alb.ap-south-1.elb.amazonaws.com" }]
      }
    }
  ]
}

Apply with aws route53 change-resource-record-sets --hosted-zone-id Z123 --change-batch file://canary.json. SetIdentifier distinguishes records that share a name.

Key points

  • Latency routing picks the Region with the lowest measured latency, not the nearest one
  • Failover routing needs health checks and low TTLs to be useful
  • Weighted routing uses weights 0-255; weight 0 removes a record from rotation
  • Geolocation routing needs a default record for unmatched locations
  • Alias records work at the zone apex and are free to query for AWS targets

Common follow-up questions

  • What is the difference between geolocation and geoproximity routing?
  • Why might users still hit the failed Region after Route 53 has failed over?
  • How is an alias record different from a CNAME?
  • How would you combine latency and failover policies for a multi-Region setup?

Interview tips

  • Name all the policies quickly, then go deep on three with a concrete use case each
  • Always bring up health checks and TTL when talking about failover; it shows you understand DNS caching
  • Contrast DNS-level weighting with ALB weighted target groups to show you know where each fits

Concepts covered

Route 53, Routing Policies, Health Checks, Latency-based Routing, Failover Routing

More AWS & Cloud Fundamentals questions