Tuesday 25 May 2021

AWS How to setup weighted routing in route53

Routing policy is one of the important AWS feature, it determines how Amazon Route53 responds to queries when you create a record.


Routing policies let you choose how Route 53 routes traffic to you resources. If you have multiple resources that perform the same operation, such as serve content for a website, choose a routing policy other than simple. Here's a brief comparison:

There are 7 types of routing policy in AWS. The top 4 routing policy are mostly used ones based on requirement.

  1. Simple: Simple records use standard DNS functionality.
  2. Weighted: Weighted records let you specify what portion of traffic to send to each resource.
  3. Geolocation: Geolocation records let you route traffic to your resources based on the geographic location of your users.
  4. Latency: Latency records let you route traffic to resources in the AWS Region that provides the lowest latency. All resources must be in AWS Regions.
  5. Failover: Failover records let you route traffic to a resource when the resource is healthy or to a different resource when the first resource is unhealthy.
  6. Multivalue answer: Multivalue answer records let you configure Route 53 to return multiple values, such as IP addresses for your web servers, in response to DNS queries.
  7. Geoproximity routing:  when you want to route traffic based on the location of your resources and, optionally, shift traffic from resources in one location to resources in another.



Weighted routing

Weighted routing lets you associate multiple resources with a single domain name (devopsvm.com) or subdomain name (dev.devopsvm.com,) and choose how much traffic is routed to each resource. This can be useful for a variety of purposes, including load balancing and testing new versions of software.

To configure weighted routing, you create records that have the same name and type for each of your resources. You assign each record a relative weight that corresponds with how much traffic you want to send to each resource. Amazon Route 53 sends traffic to a resource based on the weight that you assign to the record as a proportion of the total weight for all records in the group:


Formula for how much traffic is routed to a given resource: 
weight for a specified record / sum of the weights for all records.

For example, if you want to send a tiny portion of your traffic to one resource and the rest to another resource, you might specify weights of 1 and 255. The resource with a weight of 1 gets 1/256th of the traffic (1/(1+255)), and the other resource gets 255/256ths (255/(1+255)). You can gradually change the balance by changing the weights. If you want to stop sending traffic to a resource, you can change the weight for that record to 0.



Once you have records in hosted zones, select a record you want to add routing policy. Then you get an option to Edit Record, at the bottom you can see Routing policy select the policy you want to use based on your requirement.





No comments:

Post a Comment

Tricks and Tips