Study guide
Technical reference and lesson notes
Route 53 Latency-Based Routing and Health Checks: Hands-On Lab Guide
Purpose of This Lesson
This lab demonstrates how to deploy identical web applications in two AWS Regions and use Amazon Route 53 to route users to the endpoint with the lowest latency. It then adds health-check behavior so Route 53 can stop directing traffic to an endpoint that is no longer reachable.
The lab uses AWS CloudFormation to repeatedly create the required networking, compute, security, and load-balancing resources in two Regions:
- US East (N. Virginia),
us-east-1 - EU West (London),
eu-west-2
The application page identifies the Availability Zone serving the request, making routing behavior visible during testing.
Key Concepts
CloudFormation for repeatable regional deployment
The lab uses two YAML templates, one for each Region. Each template creates the infrastructure required for a simple public web application, including:
- A VPC and internet gateway
- Public subnets in two Availability Zones
- Route tables, routes, and subnet associations
- Security groups
- An EC2 instance running the web application
- A load balancer in front of the instance
CloudFormation provides a repeatable way to create and later remove the lab environment. The two templates are similar, but Region-specific values must be correct.
Region-specific Availability Zones and AMI IDs
Availability Zone names and Amazon Machine Image IDs are Region-specific. Before deploying a template:
- Confirm that the Availability Zones exist in the selected Region.
- Replace the Availability Zone values if using Regions other than the examples.
- Obtain the current Amazon Linux 2023 AMI ID from EC2 in each target Region.
- Use the AMI ID belonging to the same Region as the stack.
The original templates use Availability Zones such as us-east-1a, us-east-1b, eu-west-2a, and eu-west-2b.
Alias records targeting load balancers
The Route 53 records are alias records that point to the regional load balancers. Alias records allow the DNS name to reference an AWS resource such as a load balancer without manually entering a static IP address.
Latency-based routing
Latency-based routing directs a request to the configured endpoint that provides the lowest measured latency from the client’s location. This often—but not always—corresponds to the geographically closest Region.
For the lab, two records are created for the same application name:
- A US East record pointing to the US East load balancer
- A EU West record pointing to the London load balancer
Both records use latency-based routing and distinct record identifiers, such as US East ALB and EU West ALB.
Route 53 health checks
A Route 53 health check can monitor an endpoint using HTTP on port 80. In the lab, the health check targets the DNS name of the US East load balancer.
The health check is associated with the relevant Route 53 record, and target-health evaluation is enabled. When the endpoint becomes unhealthy, Route 53 stops directing requests to that record and can route traffic to the remaining healthy regional endpoint.
Health status changes are not immediate. The lab showed that several minutes could pass before a deliberately broken endpoint changed from healthy to unhealthy.
Regional Deployment and Routing Workflow
1. Deploy the US East stack
In the CloudFormation console:
- Select the US East (N. Virginia) Region.
- Choose Create stack and upload the YAML template ending in
USE1.yml. - Provide a stack name such as
US East stack. - Continue through the configuration screens and submit the stack.
- Wait until the stack reaches
CREATE_COMPLETE.
CloudFormation creates dependent resources first, such as VPC networking and security groups, followed by the EC2 instance and load balancer.
2. Deploy the EU West stack
Repeat the process in London:
- Change the console Region to EU West (London).
- Upload the template ending in
EUW2.yml. - Use a name such as
EU West stack. - Submit the stack and wait for
CREATE_COMPLETE.
The AMI ID and Availability Zone values must be valid for London.
3. Validate both regional applications
After each stack completes, copy the load balancer DNS name and open it in a browser. The response should identify the Availability Zone of the serving instance, for example:
us-east-1afor the US East deploymenteu-west-2afor the London deployment
This confirms that both regional endpoints are operational before configuring Route 53.
4. Create latency-based alias records
In the public hosted zone—for example, DCTAWS.com—create an alias record for each load balancer:
- Select the application record name.
- Choose an alias target for an Application or Classic Load Balancer.
- Select the appropriate Region and load balancer.
- Choose Latency as the routing policy.
- Assign a distinct record ID for the Region.
- Create the record.
When a client in Monaco or southern France accessed the application, the request was directed to London. When testing from a US location through a VPN, a private browser window was used to avoid cached or cookie-influenced behavior, and the request was directed to US East.
5. Add and test a health check
To test health-aware routing:
- Create a Route 53 health check for an endpoint.
- Select a domain name and enter the US East load balancer DNS name.
- Use the HTTP check on port 80 with the default advanced settings.
- Associate the health check with the appropriate Route 53 record.
- Enable target-health evaluation for the record.
- Deliberately remove the load balancer’s inbound security-group rule for port 80.
- Wait for the health check to transition from healthy to unhealthy.
- Request the application again and verify that traffic is directed to the London endpoint.
The security-group change prevents the health checker from reaching port 80 on the US East load balancer. After the endpoint becomes unhealthy, Route 53 excludes it from routing decisions.
Exam- or Assessment-Relevant Takeaways
- Latency-based routing is the appropriate choice when the requirement is to direct users to the endpoint with the lowest network latency.
- Geographical proximity is only an approximation of latency. The routing policy is based on measured latency, not simply the nearest Region on a map.
- A multi-Region design requires a corresponding record for each regional endpoint.
- Alias records are suitable for pointing Route 53 records at AWS load balancers.
- Health checks support availability-aware routing by identifying endpoints that should no longer receive traffic.
- Health-check state changes can take several minutes; do not expect an immediate routing change after breaking an endpoint.
- Region-specific AMI IDs and Availability Zone names are common causes of CloudFormation deployment failure.
- CloudFormation stack deletion is the preferred cleanup method for resources created by the templates, while Route 53 records and health checks are removed separately.
Tool / Feature Decision Guide
| Requirement | Appropriate choice | Reason |
|---|---|---|
| Recreate the same lab infrastructure in multiple Regions | CloudFormation templates | Provides repeatable deployment and centralized cleanup through stack deletion. |
| Send users to the endpoint with the lowest latency | Route 53 latency-based routing | Selects among regional records based on client-to-endpoint latency. |
| Point DNS at an AWS load balancer | Route 53 alias record | Targets the AWS resource directly rather than managing a fixed IP address. |
| Stop routing to a load balancer that cannot serve HTTP traffic | Route 53 health check plus target-health evaluation | Removes the unhealthy record from routing decisions after the health state changes. |
| Verify that each regional endpoint works independently | Load balancer DNS name | Bypasses the Route 53 application record and tests the regional endpoint directly. |
| Remove the infrastructure created by the lab | CloudFormation stack deletion | Deletes the stack-managed resources as a group. |
Common Traps / Misconceptions
- Assuming the nearest Region always wins: Latency-based routing selects the lowest-latency endpoint, which is not guaranteed to be the geographically closest.
- Using one AMI ID in every Region: Amazon Linux AMI IDs are Region-specific. Retrieve the correct AMI ID from EC2 in each deployment Region.
- Leaving the Availability Zone values unchanged: The template’s Availability Zones must exist in the chosen Region.
- Testing with a cached browser result: DNS, browser state, or cookies can make a routing test appear inconsistent. A private browser window can help validate a change.
- Expecting health checks to fail over instantly: Route 53 health status takes time to update after connectivity is broken.
- Deleting the hosted zone during cleanup: Remove only the lab’s A records and health check. Preserve the hosted zone’s NS and SOA records.
- Deleting only the load balancer: The CloudFormation stack also owns networking, security, instances, and other dependencies. Delete the stack to clean up the complete environment.
- Ignoring outdated instance metadata configuration: The lab required updated user data because the older IMDS interaction needed token-based authentication. Use the updated template supplied for the lab.
Real-World Engineer / Analyst Notes
- Validate each regional application directly before troubleshooting Route 53. This separates application or load-balancer failures from DNS-routing problems.
- Use distinct record IDs for the regional latency records so the routing configuration is easy to identify and manage.
- When testing location-based behavior, record the client’s apparent location and consider VPN effects, browser caching, and DNS caching.
- A security-group change is a useful lab failure simulation because it makes the endpoint unreachable on the monitored port without requiring application changes.
- Health checks should test the path and port that represent actual service availability. In this lab, HTTP on port 80 to the load balancer is the monitored condition.
- Monitor CloudFormation events during deployment. Resource creation is dependency-driven, so the instance and load balancer may not appear immediately.
- Remove Route 53 health checks after the exercise. Otherwise, they continue probing the endpoint and remain as separate billable or managed resources.
Quick Reference Summary
- Deploy two equivalent application stacks in separate Regions with CloudFormation.
- Update AMI IDs and Availability Zone names for the selected Regions.
- Confirm both load balancer DNS names return the expected Availability Zone.
- Create one alias record per load balancer in the public hosted zone.
- Use latency-based routing with a unique record ID for each Region.
- Create a Route 53 HTTP health check against a regional load balancer.
- Associate the check with the record and enable target-health evaluation.
- If the endpoint becomes unhealthy, Route 53 routes requests to the remaining healthy endpoint.
- Expect health status and routing changes to take several minutes.
- Delete the Route 53 records and health check, then delete both CloudFormation stacks.
Flashcards
Q: Which Route 53 routing policy should you choose when users should reach the regional endpoint with the lowest latency?
A: Choose latency-based routing. It selects the configured endpoint with the lowest measured latency from the requester’s location.
Q: Why does the lab create two Route 53 alias records for the same application?
A: Each record represents a regional load balancer. Latency-based routing can then choose between the US East and EU West endpoints.
Q: When is a Route 53 alias record useful in this lab?
A: Use it to point the application record at an AWS load balancer. The record targets the AWS resource instead of requiring a manually managed load-balancer IP address.
Q: A client in southern France is routed to London rather than US East. What is the most likely explanation?
A: London has lower measured latency from that client location. Latency-based routing commonly favors the closer Region, but it is not based solely on geographic distance.
Q: What must be changed when reusing the CloudFormation template in another Region?
A: Update the Availability Zone values and replace the AMI ID with the Amazon Linux 2023 AMI ID for the target Region.
Q: How can you verify that both regional deployments work before configuring Route 53?
A: Open each load balancer’s DNS name directly and confirm that the response identifies the expected Availability Zone.
Q: What does enabling target-health evaluation accomplish for the Route 53 record in this lab?
A: Route 53 considers the endpoint’s health when routing requests and stops sending traffic to that record after the endpoint is determined to be unhealthy.
Q: How did the lab deliberately make the US East endpoint unhealthy?
A: It removed the load balancer security group’s inbound rule, preventing the health check from reaching HTTP port 80.
Q: Why might a routing test appear unchanged immediately after breaking an endpoint?
A: Health-check state changes are not instantaneous and can take several minutes. Browser or DNS caching can also obscure a routing change.
Q: When should you use a private browser window during this lab?
A: Use one when testing from a different apparent location, such as through a VPN, to reduce the effect of existing browser state or cookies on the observation.
Q: What is the safest cleanup method for the infrastructure created by the lab templates?
A: Delete each CloudFormation stack after removing the Route 53 records and health check. Stack deletion removes the resources managed by the template as a group.
Q: Which Route 53 hosted-zone records should not be deleted during cleanup?
A: Do not delete the hosted zone’s NS and SOA records. Remove only the lab’s application A records.
Practice Questions
Question 1
A company has identical web applications in US East and EU West. It wants clients to use whichever regional endpoint has the lowest network latency. Which configuration best matches this requirement?
A. Simple routing with one record pointing to US East
B. Latency-based routing with an alias record for each regional load balancer
C. A geolocation policy with a single record for the company’s headquarters
D. Failover routing with both endpoints marked as primary
Correct answer: B
Explanation: Latency-based routing evaluates the regional endpoints and directs the request to the endpoint with the lowest measured latency. Alias records are appropriate targets for the load balancers.
Question 2
A CloudFormation deployment fails after a template is moved from us-east-1 to eu-west-2. Which issue should be checked first based on the lab configuration?
A. Whether the Route 53 hosted zone has NS records
B. Whether the template still references a US East AMI ID or unavailable Availability Zones
C. Whether the browser is using a private window
D. Whether the health check has already become unhealthy
Correct answer: B
Explanation: AMI IDs and Availability Zone names are Region-specific. Values valid in US East may not be valid in London.
Question 3
The US East load balancer is no longer reachable on HTTP port 80, but Route 53 continues sending some requests there immediately after the change. What is the best interpretation?
A. Latency-based routing ignores health status permanently
B. Alias records cannot target load balancers
C. Route 53 health status and routing behavior may take several minutes to update
D. The EU West stack must be deleted before failover can occur
Correct answer: C
Explanation: The lab demonstrated that a health check can remain healthy temporarily after connectivity is broken. The status transition and resulting routing change are not immediate.
Question 4
An engineer has finished the lab and wants to avoid leaving monitoring and infrastructure resources behind. Which cleanup sequence is appropriate?
A. Delete the hosted zone, then remove the CloudFormation stacks
B. Delete the NS and SOA records, but keep the A records
C. Delete the two application A records and health check, then delete both CloudFormation stacks
D. Delete only the load balancers because the other resources are automatically removed
Correct answer: C
Explanation: The lab’s application records and health check are removed manually, while CloudFormation removes the stack-managed infrastructure. The hosted zone and its NS/SOA records should be preserved.
WordPress Metadata
Suggested Slug:
route-53-latency-routing-health-checks-lab
Meta Description:
Learn how to deploy regional endpoints with CloudFormation and use Route 53 latency-based routing with health checks to direct traffic away from unhealthy applications.
Tags:
AWS Route 53, latency-based routing, Route 53 health checks, Amazon CloudFormation, Elastic Load Balancing, Application Load Balancer, Amazon EC2, AWS reliability, business continuity, DNS routing