
How Route 53 Latency Based Routing Chooses Where Users Go
Learn how Amazon Route 53 uses latency data, DNS resolver information, and regional records to select AWS endpoints for users. Includes a practical multi region architecture and important considerations for health based failover.
Introduction
When an application serves users from different parts of the world, sending every request to a single AWS Region can introduce unnecessary network latency.
For example, imagine hosting your application in the US East Region while most of your users are located in Europe and Asia. Those users may experience slower response times because their requests need to travel longer network paths.
One way to improve this is to deploy your application across multiple AWS Regions and use Amazon Route 53 Latency Based Routing.
But how does Route 53 actually decide which Region a user should connect to?
Does it simply choose the geographically closest AWS Region, or does it use something else?
Let's understand how this routing policy works.
What Is Route 53 Latency Based Routing?
Latency Based Routing is an Amazon Route 53 routing policy that directs DNS queries to the AWS Region that provides the lowest estimated network latency for the user.
Instead of sending every user to the same endpoint, you configure multiple DNS records pointing to resources in different AWS Regions.
Route 53 then evaluates its latency data and selects the appropriate Region when responding to DNS queries.
For example, consider an application deployed in three AWS Regions:
- US East (N. Virginia)
- Europe (Ireland)
- Asia Pacific (Singapore)
A user accessing your application from London might receive the endpoint in Europe, while a user in Singapore might receive the endpoint in Asia Pacific.
The goal is to reduce network latency by selecting a suitable AWS Region.
How Does Route 53 Decide Which Region to Use?
This is where things get interesting.
Route 53 does not simply calculate the geographical distance between the user's location and each AWS Region.
AWS maintains latency information based on network traffic between users and AWS data centers.
When Route 53 receives a DNS query, it uses this information to determine which configured AWS Region offers the lowest latency for that user.
The process can be understood in four steps.
1. A User Requests Your Application
Suppose someone opens:
https://www.example.com Their device needs to resolve the domain name into an IP address.
The DNS query eventually reaches an Amazon Route 53 name server.
2. Route 53 Identifies the User's Approximate Location
Route 53 uses information associated with the DNS query to estimate where the user is located.
In some cases, DNS resolvers support the EDNS0 Client Subnet extension.
When supported, the resolver can send a shortened version of the user's IP address to Route 53.
This can help Route 53 make a more accurate location estimate.
If the resolver does not support this extension, Route 53 uses the resolver's source IP address to estimate the location instead.
This distinction matters because the DNS resolver might be located somewhere different from the actual user.
3. Route 53 Compares Available AWS Regions
Route 53 checks the latency information for the AWS Regions where you have configured latency records.
For example, imagine your application has three regional endpoints:
- N. Virginia
- Ireland
- Singapore
For a user in London, Route 53 compares the available latency information for these Regions.
Suppose the estimated latency is:
AWS Region | Estimated latency |
|---|---|
N. Virginia | 85 ms |
Ireland | 25 ms |
Singapore | 170 ms |
These numbers are hypothetical and are only used to explain the routing decision.
In this example, Ireland provides the lowest latency.
4. Route 53 Returns the Selected DNS Record
After comparing the available Regions, Route 53 returns the DNS record associated with the selected Region.
The user's browser then connects to that endpoint.
One important detail is that Route 53 makes this decision when answering DNS queries. It does not continuously redirect every HTTP request or inspect application traffic.
DNS caching also means that a client may continue using a previously resolved endpoint until its DNS answer expires.
Practical Example: Deploying an Application Across Three AWS Regions
Let's consider a real world architecture.
You have a web application deployed in three AWS Regions.
Each Region contains an Application Load Balancer that receives traffic and forwards requests to your application servers.
Your architecture looks something like this:
User → Route 53 → Regional Application Load Balancer → Application Servers
The regional deployments are:
AWS Region | Resource |
|---|---|
us-east-1 | Application Load Balancer |
eu-west-1 | Application Load Balancer |
ap-southeast-1 | Application Load Balancer |
You want Route 53 to select the appropriate regional load balancer based on latency.
Configuring Latency Based Records
Inside your Route 53 public hosted zone, create records using the same domain name.
For example:
Record 1
- Record name: www.example.com
- Record type: A
- Routing policy: Latency
- Region: US East (N. Virginia)
- Alias target: US East Application Load Balancer
Record 2
- Record name: www.example.com
- Record type: A
- Routing policy: Latency
- Region: Europe (Ireland)
- Alias target: Europe Application Load Balancer
Record 3
- Record name: www.example.com
- Record type: A
- Routing policy: Latency
- Region: Asia Pacific (Singapore)
- Alias target: Singapore Application Load Balancer
Each record represents the same DNS name but points to a resource in a different AWS Region.
Route 53 uses the configured Region and its latency data to select the appropriate record.
You do not need to create records for every AWS Region. Route 53 chooses from the Regions you have configured.
Does Latency Based Routing Automatically Handle Regional Failures?
Not by itself.
Latency Based Routing and health based routing solve different problems.
Latency Based Routing tries to select the Region with the lowest latency.
Health checks and alias target health evaluation help Route 53 avoid routing users to unhealthy resources.
You can combine these capabilities.
For example:
- A user sends a DNS query.
- Route 53 identifies the Region with the lowest latency.
- Route 53 evaluates the health of the selected endpoint when health evaluation is configured.
- If that Region is unhealthy, Route 53 can select a healthy endpoint in another Region.
For alias records pointing to Application Load Balancers, you can configure Evaluate Target Health to Yes.
This allows Route 53 to evaluate the health of the alias target.
However, health evaluation needs to be configured correctly throughout your routing configuration. Simply creating latency records does not guarantee automatic failover.
Important Things to Understand
Before using Latency Based Routing in production, there are a few things worth considering.
1. Lowest Latency Does Not Always Mean Closest Region
Geographical distance and network latency are not the same thing.
A Region that appears geographically closer might not provide the lowest network latency because internet routing and network connectivity can affect response times.
Route 53 uses AWS latency data rather than simply selecting the closest Region on a map.
2. Routing Decisions Can Change Over Time
Network conditions change.
AWS uses latency measurements collected over a period of time, and these measurements can reflect changes in network connectivity.
A user who was routed to one Region this week might be routed to another Region later.
This is expected behavior.
3. DNS Caching Can Affect the Result
Route 53 does not control every subsequent connection made by a browser.
Once a DNS resolver receives an answer, it can cache that answer according to its TTL.
This means a user might continue connecting to a previously selected Region even after network conditions change.
4. You Need Resources in Multiple Regions
Latency Based Routing is useful when your application is actually deployed across multiple AWS Regions.
Creating DNS records for different Regions without deploying the corresponding application resources will not provide the expected performance improvements.
5. It Is Not a Replacement for Application Monitoring
Low network latency does not necessarily mean your application is healthy.
A regional endpoint might have low network latency but still suffer from database problems, overloaded application servers, or other failures.
You should monitor application health and configure appropriate health checks alongside your routing policy.
When Should You Use Latency Based Routing?
Latency Based Routing is a good choice when:
- Your application serves users across multiple geographical locations.
- You have deployed application resources in multiple AWS Regions.
- Reducing network latency is an important requirement.
- You want DNS to select regional endpoints based on AWS latency information.
- You need to combine regional routing with health based failover.
It might not be necessary for an application that serves users from a single region or does not have a multi region deployment.
If your requirement is to send users to a specific geographic location regardless of network latency, Geolocation Routing may be more suitable.
If you want to distribute traffic according to predefined percentages, Weighted Routing is a better option.
Conclusion
Amazon Route 53 Latency Based Routing helps applications running across multiple AWS Regions serve users through regional endpoints that offer lower network latency.
The important thing to remember is that Route 53 does not simply choose the geographically closest AWS Region. It uses AWS latency data to select the best available configured Region for a DNS query.
For developers building globally distributed applications, understanding this behavior is useful when designing multi region architectures, improving application response times, and planning regional failover.
One question worth thinking about:
If your application runs in three AWS Regions and the Region with the lowest latency suddenly becomes unhealthy, how would you make sure Route 53 sends users to another healthy Region?
Would you use Latency Based Routing with Evaluate Target Health, or combine it with a separate failover routing configuration?
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article