Lesson 1 of 3 Route 53, Application Recovery Controller and CloudFront

Routing Traffic and Checking Health with Amazon Route 53

Amazon Route 53 is the DNS service that decides which endpoint a client reaches. Its routing policies and health checks implement failover between Regions, distribute traffic by latency or location, and support blue/green releases. This lesson explains records and alias records, each routing policy, the types of health check and how they combine into failover designs.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain alias records and how they differ from CNAME records.
  • Describe each Route 53 routing policy and the scenarios it suits.
  • Explain endpoint, calculated and CloudWatch alarm-based health checks and how health affects answers.
  • Design active-passive and active-active failover using routing policies, health checks and record trees.

Hosted Zones and Alias Records

A public hosted zone holds the DNS records for a domain on the internet, and a private hosted zone holds records visible only to associated VPCs. Besides standard record types, Route 53 offers alias records, which point a name to an AWS resource such as a load balancer, CloudFront distribution, API Gateway endpoint, S3 website endpoint or another record in the zone. Alias records differ from CNAMEs in important ways: they work at the zone apex (for example example.com itself, where a CNAME is not allowed), they follow the target's IP address changes automatically, queries to them are free, and they can evaluate the health of the target resource with evaluate target health, without a separate health check.

Routing Policies

Each record has a routing policy that decides which answer Route 53 returns. The policies are described below and summarised in a table.

  • Simple: one record with one or more values, returned in random order, with no health checks.
  • Failover: a primary and a secondary record. Route 53 returns the primary while it is healthy and the secondary otherwise. This is the basic active-passive DR mechanism.
  • Weighted: several records share a name with relative weights, used for blue/green and canary releases or to spread load. A weight of 0 removes a record unless all are 0.
  • Latency: returns the record for the AWS Region with the lowest latency for the client, used for active-active multi-Region applications.
  • Geolocation: answers based on the client's continent, country or US state, used for content localisation and regulatory restrictions; a default record handles unmatched locations.
  • Geoproximity: answers based on geographic distance, with a bias that expands or shrinks a Region's area, configured with traffic flow.
  • Multivalue answer: returns up to eight healthy records at random, a simple form of client-side load balancing with health checks.
  • IP-based: answers based on the client's IP address ranges (CIDR collections), for example to route a known ISP's users to a specific endpoint.

The table below summarises the routing policies and their typical uses.

PolicyDecision based onTypical use
SimpleNothingSingle resource
FailoverPrimary healthActive-passive DR
WeightedWeightsBlue/green, canary, gradual migration
LatencyLowest latency RegionActive-active multi-Region
GeolocationClient locationLocalisation, compliance
GeoproximityDistance with biasShifting load between Regions
Multivalue answerHealth; random selectionSeveral healthy IPs
IP-basedClient CIDRNetwork-specific routing
Sort into groups

Choose the routing policy

Exam skills 3.1.3 · 3.2.4

Choose the Route 53 routing policy for each requirement.

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

Health Checks

Route 53 health checks determine which records are healthy. There are three types.

Endpoint health checks

Health checkers in multiple locations around the world send HTTP, HTTPS or TCP requests to an IP address or domain name at an interval of 30 seconds (standard) or 10 seconds (fast). An endpoint is unhealthy when a request fails the configured number of consecutive times (the failure threshold, default 3), and Route 53 considers the endpoint healthy if more than 18% of checkers report it healthy. HTTP checks can require a string in the first 5,120 bytes of the response body. Because checkers are on the internet, endpoint checks cannot reach private resources directly, and firewalls must allow the Route 53 health checker IP ranges.

Calculated health checks

Combine the results of other health checks with AND, OR or a minimum number of healthy children, for example declaring a Region healthy only if at least two of its three critical services are healthy.

CloudWatch alarm health checks

Take their status from a CloudWatch alarm. They are the way to health-check private resources, such as an internal service in a private subnet, or to fail over based on application metrics such as error rate, which may indicate failure before an endpoint stops responding.

Health checks can notify through a CloudWatch alarm on the HealthCheckStatus metric, which Route 53 publishes in us-east-1. For alias records, evaluate target health reuses the target's own health: for an ALB, the alias is unhealthy when no healthy targets remain in any target group.

Health checks on private endpoints

If a health check is attached to a record whose endpoint is in a private subnet and the health check uses the endpoint's private IP, it will always fail, because checkers are on the internet. Use a CloudWatch alarm-based health check for private resources.

Scenario questions

Check health with Route 53

Exam skills 4.3.7 · 3.3.1

Practise choosing Route 53 health checks.

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

Failover Designs

Routing policies can be nested into trees, in which a record's alias points to another set of records, each with its own policy and health. Common designs are described below.

Active-passive

A failover record pair: the primary alias points to the primary Region's load balancer with evaluate target health, and the secondary points to the recovery Region or a static maintenance page on S3. When the primary becomes unhealthy, Route 53 answers with the secondary. RTO includes the health check detection time plus DNS caching for the record's TTL.

Active-active

Latency records for each Region, each with evaluate target health or a health check. Clients go to their lowest-latency healthy Region, and an unhealthy Region is removed from answers automatically.

Combined

Latency records whose targets are weighted records within each Region allow canary releases inside each Region while routing between Regions by latency; failover records at the top level can send everything to a static site if every Region fails.

Health-check-driven DNS failover is automatic, which suits many workloads, but the decision is made by Route 53 from health check data. Where operators want to control Regional failover explicitly, Application Recovery Controller routing controls, described in the next lesson, are used.

The following diagram shows the active-passive and combined designs as record trees.

Two Route 53 failover designs. Active-passive: a failover record pair whose primary alias points to the primary Region's load balancer with evaluate target health, and whose secondary points to the recovery Region or a static page on S3. Combined: latency records route users to the nearest healthy Region, weighted records inside each Region allow canary releases, and a failover record at the top sends everything to a static site if every Region fails.
Records can point to other records, each with its own policy and health.
Worked example

Active-Passive Regional Failover

A customer portal runs in eu-west-1 with a pilot light environment in eu-central-1. During an outage, traffic must move automatically to eu-central-1 and, if that is unavailable too, to a static status page.

  1. Primary

    Create a failover primary alias record for portal.example.com pointing to the eu-west-1 ALB with evaluate target health, plus a CloudWatch alarm health check on the 5xx error rate combined in a calculated health check.

  2. Secondary

    Create a failover secondary alias record pointing to a second record set: a failover pair whose primary is the eu-central-1 ALB and whose secondary is an S3 static website with the status page.

  3. Readiness

    Set a low TTL, alarm on the health check status, and automate scaling of the pilot light environment when the failover is detected.

Check yourself

Which record type should point example.com (the zone apex) to an Application Load Balancer?

Show answer

An alias A (and AAAA) record. CNAME records are not allowed at the zone apex, and alias records follow the load balancer's changing IP addresses and can evaluate its health.

Exam Tips

Remember for the exam

  • Alias records work at the zone apex, follow AWS resource IP changes, are free to query and can evaluate target health.
  • Failover policy for active-passive DR; latency policy for active-active; weighted for blue/green and canary; geolocation for location-based rules.
  • Endpoint health checks come from internet locations (30 s or 10 s interval, threshold 3); use CloudWatch alarm health checks for private resources or metric-based failover.
  • Calculated health checks combine child checks; record trees combine policies.
  • DNS failover time includes detection plus TTL caching.