How does ELB DNS and traffic flow operate with different cross-zone load balancing configurations?

3 minute read
0

I configured my Elastic Load Balancer (ELB) for two Availability Zones, but it shows only one IP address in DNS.

Short description

With Application Load Balancers, cross-zone load balancing is always turned on at load balancer level. Cross-zone load balancing can't be turned off, but it can be changed at the target group level.

However, with Network Load Balancers and Gateway Load Balancers, cross-zone load balancing is turned off by default.

When cross-zone load balancing is turned off, an Availability Zone must have at least one healthy target in each target group. When cross-zone load balancing is turned on, there must be at least one healthy target in each target group in any Availability Zone. Each condition keeps the Availability Zone healthy, and adds the corresponding Elastic Load Balancer node IP address to the Elastic Load Balancer DNS.

Resolution

When cross-zone load balancing is turned off

The following is an example of when cross-zone load balancing is turned off between two Availability Zones, AZ1 and AZ2.

Availability Zone 1 (AZ1) has two target groups, A and B, each with its own target, A1 and B1. Target A1 is unhealthy and target B1 is healthy. Because target A1 is unhealthy, AZ1 is also unhealthy.

Availability Zone 2 (AZ2) also has two target groups, A and B, each with its own target, A2 and B2. Targets A2 and B2 are both healthy. Because each target in both target groups is healthy, AZ2 is healthy.

The Elastic Load Balancer includes the IP address of AZ2 in the Elastic Load Balancer's DNS because AZ2 is the only healthy Availability Zone. As a result, when you resolve the domain of the Elastic Load Balancer, the IP address of AZ2 is the only one that appears.

Traffic then gets routed through the Elastic Load Balancer node in AZ2 to the healthy target in the corresponding target group. If there are multiple healthy targets in a target group, then one target is selected based on the routing algorithm of the load balancer.

If both Availability Zones are unhealthy, then the Elastic Load Balancer fails open. Each Elastic Load Balancer IP address is then added to the DNS of the load balancer.

When cross-zone load balancing is turned on

The following is an example of when cross-zone load balancing is turned on using the same Availability Zones, AZ1 and AZ2:

In AZ1, target A1 is unhealthy and target B1 is healthy. In AZ2, both targets A2 and B2 are healthy. Because each Availability Zone has at least one healthy target, Elastic Load Balancer includes both IP addresses in the DNS for the Elastic Load Balancer hostname.

Traffic then gets routed to any of the Elastic Load Balancer nodes and forwarded to the targets in the corresponding target groups. If there are multiple healthy targets in a target group, then a target is selected based on the routing algorithm of the load balancer.

If target B1 in AZ1 is unhealthy and target B2 in AZ2 is also unhealthy, then both Availability Zones are unhealthy. Because neither Availability Zone is healthy, the Elastic Load Balancer fails open. Each Elastic Load Balancer IP address is then added to the DNS of the load balancer. As a result, when you resolve the domain, the IP addresses for both Availability Zones appear.

Related information

Application Load Balancers now support turning off cross zone load balancing per target group

AWS OFFICIAL
AWS OFFICIALUpdated a year ago