DevOps Peach

AWS Basics · DNS with Amazon Route 53 · Lesson 3 of 5

Simple, Weighted, and Latency Routing

Choose policies for traffic distribution and latency.

Practice interactively →

A policy selects answers; it does not proxy traffic

Route 53 returns DNS answers, and clients connect directly to endpoints, so DNS caching affects traffic-shift speed. A routing policy decides which record values go into each answer.

flowchart LR
  Q["DNS query<br/>app.example.com"] --> S{"Routing policy"}
  S -- "Simple" --> O["One record set<br/>all values"]
  S -- "Weighted 90 / 10" --> W["v1 stable<br/>or v2 canary"]
  S -- "Latency" --> L["Region with lowest<br/>measured latency"]
  W --> HC["Health check<br/>skip unhealthy"]
  L --> HC
  %% step Q: A resolver asks for the name on behalf of a user.
  %% step S: Records with the same name and type but a different set identifier form one policy.
  %% step O: Simple returns every value in the record, in random order, with no health checks.
  %% step W: Weighted picks one record in proportion to its weight, for example 90 to 10.
  %% step L: Latency picks the Region whose endpoint has the lowest measured latency from the resolver.
  %% step HC: With health checks attached, unhealthy records are left out of answers.

Simple

Simple fits one resource or multiple values without per-record health evaluation. If a record holds several IPs, the client picks one, but a dead IP still gets returned. You can have only one simple record per name and type.

Weighted

Weighted distributes by relative weights: the share for a record is its weight divided by the sum of weights. Weights are not fixed percentages when the total changes, and DNS caches make short observations uneven. Typical uses:

Each weighted record needs a unique SetIdentifier.

Latency

Latency routing selects the AWS Region with the lowest measured latency for the resolver or user path, not the nearest point on a map. Latency data comes from AWS measurements between networks and Regions and can change over time. You create one record per Region (for example ap-southeast-1 and eu-west-1), each pointing to that Region's endpoint.

The other policies

Policy Chooses by Typical use
Failover Health of primary Active-passive DR
Geolocation User's continent or country Language, legal restrictions
Geoproximity Distance plus a bias Shift traffic between Regions gradually
Multivalue answer Up to 8 healthy random records Simple client-side spreading
IP-based Client IP ranges you define Route specific ISPs or networks

These are covered in the next lesson with health checks.

Weighted records with health checks support canaries; choose TTLs that let shifts react quickly enough — a 60-second TTL is common for records you plan to change.

Command Purpose
aws route53 change-resource-record-sets --hosted-zone-id Z0123456789ABC --change-batch file://weighted.json Create weighted records
dig app.example.com A Observe answers and TTL
for i in $(seq 20); do dig +short app.example.com; done Sample how answers are distributed

Traps: expecting exact 90/10 splits over a few minutes; reading "latency" as "geographically closest"; forgetting SetIdentifier on weighted records.

Practice interactively →