CE to prefer AWS NLB endpoint in the same AZ to reduce inter-AZ data transfer costs

For an AWS VPC site cluster of 3 nodes (1 CE in each AZ), when defining an origin pool with the following details:

Type: DNS Name of Origin Server on given Sites

DNS Name: <AWS NLB FQDN, e.g. my-nlb-123456789012.us-west-2.elb.amazonaws.com>

SIte: <AWS VPC site>


The CE resolves the NLB FQDN to multiple IP addresses, 1 for each AZ in which the NLB is present. E.g.


$ dig my-nlb-123456789012.us-west-2.elb.amazonaws.com +short

10.0.1.100 <-AZ A

10.0.2.50 <- AZ B

10.0.3.56 <- AZ C


Traffic is then load balanced from CE to each of the NLB IPs, which can lead to inter-AZ traffic flow that comes with a cost (Inter-AZ data transfer is free for ALB, not NLB). E.g. CE in AZ-A can send traffic to NLB IP in AZ-B or AZ-C


I have a customer who wants to reduce this inter-AZ data transfer cost by having the CE prefer NLB IPs in the same AZ. AWS provides a mechanism to select NLB in certain AZs by prefixing the NLB domain with the AZ name, e.g. us-west-2a.my-nlb-123456789012.us-west-2.elb.amazonaws.com


Example implementation could be:

  1. User provide an NLB fqdn my-nlb-123456789012.us-west-2.elb.amazonaws.com

  2. User toggle "prefer local AZ"

  3. Multiple endpoints are created for the NLB FQDN - 1 for each AZ, e.g.

    1. us-west-2a.my-nlb-123456789012.us-west-2.elb.amazonaws.com

    2. us-west-2b.my-nlb-123456789012.us-west-2.elb.amazonaws.com

    3. us-west-2c.my-nlb-123456789012.us-west-2.elb.amazonaws.com

  4. each CE (hopefully being aware of the AZ it's in), will assign higher weight or preference the endpoint in the same AZ


  • Leon Seng
  • Mar 9 2023
  • Attach files