Critical Concepts of Weighted Routing Policy in AWS
- Weighted Routing Policy: This policy allows you to assign a percentage of DNS requests to specific resources using weights. It's a feature of Amazon Route 53.
How It Works
- Assignment of Weights: Each EC2 instance (or resource) is assigned a weight (e.g., 70, 20, 10). These weights dictate the percentage of DNS responses that will redirect to each instance.
- Distribution Calculation: The traffic percentage directed to each record is calculated as the weight of the record divided by the total weights of all documents. This creates a proportional distribution of traffic.
- Flexibility: Weights do not need to sum up to 100. They are relative indicators of how much traffic should go to each instance compared to others under the same DNS name.
- DNS Record Requirements: DNS records must have the same name and type for weighted routing to work. They can also be associated with health checks.
Use Cases
- Load Balancing: Distributing load across different instances, possibly in other regions.
- Application Version Testing: Directing a small portion of traffic to a new application version to test it.
- Traffic Shifting: Gradually shifting traffic from one resource to another by adjusting weights. Setting a weight to zero stops traffic to that resource.
Practical Example
- Setup in AWS Console:
- I created three A records under
weighted.stephanetheteacher.com with weights of 10, 70, and 20 for instances in ap-southeast-1, us-east-1, and eu-central-1, respectively.
- They used a three-second low TTL (Time To Live) for demonstration, although longer TTLs are used in real scenarios.
- She demonstrated how traffic distribution aligns with the set weights, with most requests directed to the instance with the highest weight.

Observations
- Real-time Traffic Distribution: Refreshing the URL
weighted.stephanetheteacher.com showed responses from different regions based on their weights, confirming the weighted routing policy's effect.
- DNS Query Insights: The
dig command provided insights into how DNS queries were resolved to different IP addresses based on the assigned weights.
Conclusion
The weighted routing policy in Amazon Route 53 offers a powerful tool for managing DNS responses and traffic distribution across multiple resources based on defined weights. This feature is handy for load balancing, testing new application versions, and dynamically managing traffic flow.