Tuesday, June 10, 2025

Routing Policies – Multi-Value

Routing Policies – Multi-Value Routing

Multi-Value Routing is a DNS-based routing policy used to return multiple healthy records (IP addresses or endpoints) in response to a DNS query. It is a simple way to implement basic load balancing and high availability without a separate load balancer.

 The concept of Multi-Value Routing

In Multi-Value Routing, the DNS server returns multiple values (e.g., A or AAAA records) when queried. Each of these values typically corresponds to a different instance of your application (in different Availability Zones, regions, or servers).

If health checks are configured, only healthy endpoints will be returned in the response.

 Use Case Example

Imagine a web app running on three EC2 instances behind no load balancer:

  • app-server-1 – IP: 192.0.2.1
  • app-server-2 – IP: 192.0.2.2
  • app-server-3 – IP: 192.0.2.3

When a client resolves www.example.com, the DNS returns all three IPs. The client selects one, usually randomly or based on OS/network stack logic.

 Key Features

Feature

Description

Multiple Records

Returns multiple A/AAAA records.

Health Checks

Can associate Route 53 health checks with each record.

Built-in Load Sharing

Traffic gets distributed across multiple endpoints.

No Load Balancer Needed

Lightweight alternative to ELB/ALB for some scenarios.

 Pros

  • Simple & cost-effective: No load balancer required.
  • Improves availability: Fails over to healthy endpoints.
  • Easy to implement: Straightforward setup in DNS.
  • Works globally: All clients can receive multiple endpoints.

 Cons

  • Basic traffic distribution: No control over traffic percentage or geography.
  • Client-side logic: Depends on client/OS behavior to pick an IP.
  • Not true load balancing: It only offers rudimentary distribution.

 How twtech Configures Routing Policies – Multi-Value  in AWS Route 53

  1. Create a Record Set for your domain (e.g., www.twtech.com).
  2. Select Routing Policy = Multi-value answer routing.
  3. Add multiple IPs or endpoint records.
  4. (Optional) Attach health checks to each value.
  5. Enable “Evaluate target health” if using alias records.

 DNS Response Behavior

  • Up to 8 healthy records are returned in response to a DNS query.
  • If no health checks are configured, Route 53 returns all records.
  • If all health checks fail, Route 53 still returns all records (to avoid full outage due to false negatives).

 Example DNS Response (A record)

Query to: api.twtech.com

# json 

{

  "Answers": [

    {"IP": "192.0.2.1"},

    {"IP": "192.0.2.2"},

    {"IP": "192.0.2.3"}

  ]

}

 When to Use Multi-Value Routing

Use it when:

  • You want simple DNS-based failover and basic load distribution.
  • You're not using a load balancer but want to distribute traffic.
  • You need a cost-efficient way to improve resilience.
  • You want to improve DNS-level redundancy.

Project: Hands-on

How twtech creates and use the multi-value routing policy for it traffic to resources:

Select the hosted zone to create the record on: twtech.click

Create a record: multi-valuepolicy.twtech.click






Verify that the multi-value policy is working seamlessly from the url on the browser: multi-valuepolicy.twtech.click

From:

To:

Refresh page:

From CloudShell:

Install packages to use the dig and nslookup commands: sudo yum install bind-utils -y

Lets lookup and dig into the multi-valuepolicy record created: nslookup multi-valuepolicy.twtech.click

dig multi-valuepolicy.twtech.click

twtech-insights:

The dig dig and nslookup commands reveals that all the three resoures in all the regions are reachable.

No comments:

Post a Comment

Kubernetes Clusters | Upstream Vs Downstream.

  The terms "upstream" and "downstream" in the context of Kubernetes clusters often refer to the direction of code fl...