AWS Route 53

Table of Contents

file

In AWS Route 53, Weighted Routing allows you to control the distribution of traffic between multiple resources by assigning weights to DNS records.

How Weighted Routing Works

  • Each DNS record in a weighted routing policy has an associated weight (a number between 0 and 255).
  • The proportion of traffic directed to each record is determined by its weight relative to the total weight of all records.

Weight Value Meaning

  • A higher weight means more traffic is routed to that resource.
  • A weight of 0 means the record receives no traffic (but remains in DNS).
  • The traffic percentage is calculated as:

    [
    \frac{\text{Record Weight}}{\text{Total Weight of All Records}} \times 100
    ]

Example

Suppose you have two EC2 instances and set the following weights:

  • Instance A → Weight = 30
  • Instance B → Weight = 70

Total weight = 30 + 70 = 100

  • Instance A gets 30% of traffic.
  • Instance B gets 70% of traffic.

If you later change the weights to 20 and 80, then:

  • Instance A gets 20% of traffic.
  • Instance B gets 80% of traffic.

How to Set Weighted Routing in Route 53

  1. Go to AWS Route 53 Console → Open Hosted Zones.
  2. Choose Your Domain → Select the record set you want to configure.
  3. Create or Edit a Record Set → Set:
    • Record Type (e.g., A, CNAME).
    • Routing Policy → Select Weighted.
    • Set Weight Value (e.g., 30, 70).
    • Health Check (Optional) → Ensures traffic goes to healthy resources.
  4. Repeat for Additional Records → Assign different weights.
  5. Save Changes.

Use Cases

  • Gradual traffic shifting for blue/green deployments.
  • Load balancing across multiple resources without a load balancer.
  • A/B testing different services by sending different amounts of traffic.

Would you like a hands-on example with Terraform or AWS CLI?

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: 似水流年