| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Topics
With latency-based routing, Route 53 can direct your users to the lowest-latency AWS endpoint available. For example,
you may associate a DNS name like www.example.com with Elastic Load Balancing load balancers or with Amazon EC2 instances or
Elastic IP addresses that are hosted in the US East (Virginia) and EU West (Ireland) regions. The Route 53 DNS servers decide,
based on network conditions of the past couple of weeks, which instances in which regions should serve particular users.
A user in London will likely be directed to the EU West (Ireland) instance, a user in Chicago will likely be directed to the
US East (Virginia) instance, and so on. Route 53 supports latency-based routing for A, AAAA, TXT, and CNAME resource record sets,
as well as aliases to A and AAAA resource record sets.
For a smooth, low-risk transition, you can combine weighted and latency resource record sets to gradually migrate from
standard routing to latency-based routing with full control and rollback capability at each stage. Let's consider an example in which
www.example.com is currently hosted on an Amazon EC2 instance in the US East (Virginia) region.
The instance has the Elastic IP address W.W.W.W. Suppose you want to continue routing traffic to the
US East region when applicable while also beginning to direct users to additional Amazon EC2 instances in the US West (San Francisco) region
(Elastic IP X.X.X.X) and in the EU West (Ireland) region (Elastic IP Y.Y.Y.Y). The Route 53 hosted zone for
example.com already has a resource record set for www.example.com that has a Type of A
and a Value (an IP address) of W.W.W.W.
When you're finished with the following example, you'll have two weighted alias resource record sets:
You'll convert your existing resource record set for www.example.com into a
weighted alias resource record set that continues to direct the majority of your traffic to your existing
Amazon EC2 instance in the US East region.
You'll create another weighted alias resource record set that initially directs only a small portion of your traffic to your latency resource record sets, which route traffic to all three regions.
By updating the weights in these weighted alias resource record sets, you can gradually shift from routing traffic only to the US East region to routing traffic to all three regions in which you have Amazon EC2 instances.
To Transition to Latency-Based Routing
Make a copy of the resource record set for www.example.com, but use a new domain name, for example,
copy-www.example.com. Give the new resource record set the same Type (A) and
Value (W.W.W.W) as the resource record set for www.example.com.
Update the existing A record for www.example.com to make it a weighted alias
resource record set:
For the value of Alias Target, specify copy-www.example.com.
For the value of Weight, specify 100.
When you're finished with the update, Route 53 will continue to use this resource record set to
route all traffic to the resource that has an IP address of W.W.W.W.
Create a latency resource record set for each of your Amazon EC2 instances, for example:
US East (Virginia), Elastic IP address W.W.W.W
US West (San Francisco), Elastic IP address X.X.X.X
EU West (Ireland), Elastic IP address Y.Y.Y.Y
Give all of the latency resource record sets the same domain name, for example, www-lbr.example.com
and the same type, A.
When you're finished creating the latency resource record sets, Route 53 will continue to route traffic using the resource record set that you updated in Step 2.
You can use www-lbr.example.com for validation testing, for example, to ensure that each endpoint
can accept requests.
Let's now add the www-lbr.example.com latency resource record set into the www.example.com
weighted resource record set and begin routing limited traffic to the corresponding Amazon EC2 instances. This means that the
Amazon EC2 instance in the US East (Virginia) region will be getting traffic from both weighted resource record sets.
Create another weighted alias resource record set for www.example.com:
For the value of Alias Target, specify www-lbr.example.com.
For the value of Weight, specify 1.
When you finish and your changes are synchronized to Route 53 servers, Route 53 will begin to route a tiny fraction of your traffic (1/101) to the Amazon EC2 instances for which you created latency resource record sets in Step 3.
As you develop confidence that your endpoints are adequately scaled for the incoming traffic, adjust the weights accordingly. For example, if you want 10% of your requests to be based on latency-based routing, change the weights to 90 and 10, respectively.
For more information about creating latency resource record sets, see Creating Latency Resource Record Sets.
If you're using latency based routing and you want to add an instance in a new region, you can gradually shift traffic to the new region in the same way that you gradually shifted traffic to latency-based routing in Transitioning to Latency-Based Routing in Route 53.
For example, suppose you're using latency-based routing to route traffic for www.example.com, and you
want to add an Amazon EC2 instance in Asia Pacific North East (Tokyo) to your instances in US East (Virginia),
US West (San Francisco), and EU West (Ireland). The following example procedure explains one way that you could add
an instance in another region.
For this example, the Route 53 hosted zone for example.com already has a weighted alias
resource record set for www.example.com that is routing traffic to the latency-based
resource record sets for www-lbr.example.com:
US East (Virginia), Elastic IP address W.W.W.W
US West (San Francisco), Elastic IP address X.X.X.X
EU West (Ireland), Elastic IP address Y.Y.Y.Y
The weighted alias resource record set has a weight of 100. After you transitioned to latency-based routing, assume that you deleted the other weighted resource record set that you used for the transition.
To Add Another Region to Your Latency-Based Routing in Route 53
Create four new latency-based resource record sets that include the three original regions as well as the new region to which you want to start routing traffic.
US East (Virginia), Elastic IP address W.W.W.W
US West (San Francisco), Elastic IP address X.X.X.X
EU West (Ireland), Elastic IP address Y.Y.Y.Y
Asia Pacific North East (Tokyo), Elastic IP address Z.Z.Z.Z
Give all of the latency resource record sets the same new domain name, for example,
www-lbr-2012-04-30.example.com, and the same type, A.
When you're finished creating the latency resource record sets, Route 53 will continue to
route traffic using the original weighted alias resource record set (www.example.com) and
latency resource record sets (www-lbr.example.com).
You can use the www-lbr-2012-04-30.example.com resource record sets for validation testing,
for example, to ensure that each endpoint can accept requests.
Create a weighted alias resource record set for the new latency resource record sets:
For the domain name, specify the name for the existing weighted alias resource record set,
www.example.com.
For the value of Alias Target, specify
www-lbr-2012-04-30.example.com.
For the value of Weight, specify 1.
When you finish, Route 53 will begin to route a tiny fraction of your traffic (1/101)
to the Amazon EC2 instances for which you created the www-lbr-2012-04-30.example.com
latency resource record sets in Step 1. The remainder of the traffic will continue to be routed to the
www-lbr.example.com latency resource record sets, which do not include the Amazon EC2 instance
in the Asia Pacific North East (Tokyo) region.
As you develop confidence that your endpoints are adequately scaled for the incoming traffic,
adjust the weights accordingly. For example, if you want 10% of your requests to be routed to the
latency resource record sets that include the Tokyo region, change the weight for www-lbr.example.com
from 100 to 90 and the weight for www-lbr-2012-04-30.example.com from 1 to 10.
For more information about creating weighted resource record sets, see Creating Weighted Resource Record Sets. For more information about creating latency resource record sets, see Creating Latency Resource Record Sets.
If your application is running on Amazon EC2 instances in two or more Amazon EC2 regions, and if you have more than one Amazon EC2 instance in one or more regions, you can use latency-based routing to route traffic to the correct region and then use weighted resource record sets to route traffic to instances within the region based on weights that you specify.
For example, suppose you have three Amazon EC2 instances with Elastic IP addresses in the US East (Virginia) region and you want to distribute requests across all three IPs evenly for users for whom US East (Virginia) is the appropriate region. Just one Amazon EC2 instance is sufficient in the other regions, although you can apply the same technique to many regions at once.
To use latency and weighted resource record sets in Route 53 to route traffic to multiple Amazon EC2 instances in a region
Create a group of weighted resource record sets for the Amazon EC2 instances in the region. Note the following:
Give each weighted resource record set the same value for Name
(for example, us-east.example.com) and Type.
For Value, specify the value of one of the Elastic IP addresses.
If you want to weight the Amazon EC2 instances equally, specify the same value for Weight.
Specify a unique value for Set ID for each resource record set.
If you have multiple Amazon EC2 instances in other regions, repeat Step 1 for the other regions. Specify a different value for Name in each region.
For each region in which you have multiple Amazon EC2 instances (for example, US East), create a
latency alias resource record set. For the value of Alias Target, specify the value of the
Name field (for example, us-east.example.com) that you assigned to the
weighted resource record sets in that region.
For each region in which you have one Amazon EC2 instance, create a latency resource record set. For the value of Name, specify the same value that you specified for the latency alias resource record sets that you created in Step 3. For Value, specify the Elastic IP address of the Amazon EC2 instance in that region.
For more information about creating weighted resource record sets, see Creating Weighted Resource Record Sets. For more information about creating latency resource record sets, see Creating Latency Resource Record Sets.
Route 53 lets you configure weighted resource record sets. For a given name and type (for example, www.example.com, type A),
you can configure up to 100 alternative responses, each with its own weight. When responding to queries for www.example.com,
Route 53 DNS servers select a weighted random response to return to DNS resolvers. The value of a weighted resource record set that has
a weight of 2 is returned, on average, twice as often as the value of a weighted resource record set that has a weight of 1.
If you need to direct traffic to more than 100 endpoints, one way to achieve this is to use a tree of weighted alias resource record sets and weighted resource record sets. For example, the first "level" of the tree may be up to 100 weighted alias resource record sets, each of which can, in turn, point to up to 100 weighted resource record sets. Route 53 permits up to three levels of recursion, allowing you to manage up to 1,000,000 unique weighted endpoints.
A simple two-level tree might look like this:
Weighted alias resource record sets
www.example.com aliases to www-a.example.com with a weight of 1
www.example.com aliases to www-b.example.com with a weight of 1
Weighted resource record sets
www-a.example.com, type A, value 192.0.2.1, weight 1
www-a.example.com, type A, value 192.0.2.2, weight 1
www-b.example.com, type A, value 192.0.2.3, weight 1
www-b.example.com, type A, value 192.0.2.4, weight 1
For more information about creating weighted resource record sets, see Creating Weighted Resource Record Sets. For more information about creating weighted alias resource record sets, see How to Create Weighted Alias Resource Record Sets.
A Route 53 weighted resource record set can only be associated with one record, meaning a combination of
one name (for example, example.com) and one record type (for example, A). But it is often desirable to
weight DNS responses that contain multiple records.
For example, you might have eight Amazon EC2 instances or Elastic IP endpoints for a service. If the clients of that service support connection retries (as all common browsers do), then providing multiple IP addresses in DNS responses provides those clients with alternative endpoints in the event of the failure of any particular endpoint. You can even protect against the failure of an availability zone if you configure responses to contain a mix of IPs hosted in two or more availability zones.
Multi-record answers are also useful when a large number of clients (for example, mobile web applications) share a small set of DNS caches. In this case, multi-record answers allow clients to direct requests to several endpoints even if they receive a common DNS response from the shared cache.
These types of weighted multi-record answers can be achieved by using a combination of resource record sets and weighted alias resource record sets. You can group eight endpoints into two distinct record sets containing four IP addresses each:
endpoint-a.example.com, type A, with the following values:
192.0.2.1
192.0.2.2
192.0.2.128
192.0.2.129
endpoint-b.example.com, type A, with the following values:
192.0.2.3
192.0.2.4
192.0.2.130
192.0.2.131
You can then create a weighted alias resource record set that points to each group:
www.example.com aliases to endpoint-a.example.com, type A, weight 1
www.example.com aliases to endpoint-b.example.com, type A, weight 1
For more information about creating weighted alias resource record sets, see How to Create Weighted Alias Resource Record Sets.