How health checks work in complex Amazon Route 53 configurations

Checking the health of resources in complex configurations works much the same way as in simple configurations. However, in complex configurations, you use a combination of alias records (such as weighted alias and failover alias) and non-alias records to build a decision tree that gives you greater control over how Route 53 responds to requests.

For example, you might use latency alias records to select a region close to a user and use weighted records for two or more resources within each region to protect against the failure of a single endpoint or an Availability Zone. The following diagram shows this configuration.

DNS configuration that includes latency alias records and weighted alias records.

Here's how Amazon EC2 and Route 53 are configured. Let's start at the bottom of the tree because that's the order that you'll create records in:

DNS configuration that includes latency alias records and weighted alias records.

The preceding diagram illustrates the following sequence of events:

  1. Route 53 receives a query for example.com. Based on the latency for the user making the request, Route 53 selects the latency alias record for the us-east-1 region.
  2. Route 53 selects a weighted record based on weight. Evaluate Target Health is Yes for the latency alias record, so Route 53 checks the health of the selected weighted record.
  3. The health check failed, so Route 53 chooses another weighted record based on weight and checks its health. That record also is unhealthy.
  4. Route 53 backs out of that branch of the tree, looks for the latency alias record with the next-best latency, and chooses the record for ap-southeast-2.
  5. Route 53 again selects a record based on weight, and then checks the health of the selected resource. The resource is healthy, so Route 53 returns the applicable value in response to the query.
Topics

What happens when you associate a health check with an alias record?

You can associate a health check with an alias record instead of or in addition to setting the value of Evaluate Target Health to Yes. However, it's generally more useful if Route 53 responds to queries based on the health of the underlying resources—the HTTP servers, database servers, and other resources that your alias records refer to. For example, suppose the following configuration:

In this configuration, both of the following must be true before Route 53 will return the applicable value for a weighted record:

In the following illustration, the health check for the latency alias record on the top left failed. As a result, Route 53 stops responding to queries using any of the weighted records that the latency alias record refers to even if they're all healthy. Route 53 begins to consider these weighted records again only when the health check for the latency alias record is healthy again. (For exceptions, see How Amazon Route 53 chooses records when health checking is configured.)

DNS configuration that includes an alias record with both Evaluate Target Health set to Yes and a health check on the alias record.

What happens when you omit health checks?

In a complex configuration, it's important to associate health checks with all the non-alias records. In the following example, a health check is missing on one of the weighted records in the us-east-1 region.

DNS configuration that includes one failed health check and one record that has no health check.

Here's what happens when you omit a health check on a non-alias record in this configuration:

  1. Route 53 receives a query for example.com. Based on the latency for the user making the request, Route 53 selects the latency alias record for the us-east-1 region.
  2. Route 53 looks up the alias target for the latency alias record, and checks the status of the corresponding health checks. The health check for one weighted record failed, so that record is omitted from consideration.
  3. The other weighted record in the alias target for the us-east-1 region has no health check. The corresponding resource might or might not be healthy, but without a health check, Route 53 has no way to know. Route 53 assumes that the resource is healthy and returns the applicable value in response to the query.

What happens when you set evaluate target health to No?

In general, you should set Evaluate Target Health to Yes for all the alias records in a tree. If you set Evaluate Target Health to No, Route 53 continues to route traffic to the records that an alias record refers to even if health checks for those records are failing.

In the following example, all the weighted records have associated health checks, but Evaluate Target Health is set to No for the latency alias record for the us-east-1 region:

DNS configuration that includes an alias record with Evaluate Target Health set to No.

Here's what happens when you set Evaluate Target Health to No for an alias record in this configuration:

  1. Route 53 receives a query for example.com. Based on the latency for the user making the request, Route 53 selects the latency alias record for the us-east-1 region.
  2. Route 53 determines what the alias target is for the latency alias record, and checks the corresponding health checks. They're both failing.
  3. Because the value of Evaluate Target Health is No for the latency alias record for the us-east-1 region, Route 53 must choose one record in this branch instead of backing out of the branch and looking for a healthy record in the ap-southeast-2 region.