1
votes

I'm trying to better understand how traffic is distributed across availability zones within a Network Load Balancer, and whether instances from one IP (subnet-b) can receive traffic from another IP (subnet-a).

The setup:

Network Load Balancer:

Availability Zones
subnet-a - ap-southeast-2a 
IPv4 address: Elastic IP 54.xxx.xxx.101 
(Contains multiple ec2 instances)

subnet-b - ap-southeast-2b 
IPv4 address: Elastic IP 54.xxx.xxx.102  
(Contains multiple ec2 instances)

External DNS Records:

example.com A Record 54.xxx.xxx.101

Will instances in subnet-b (54.xxx.xxx.102) ever receive traffic from example.com (54.xxx.xxx.101)?

AWS recommend that you enable multiple Availability Zones to assure traffic is routed to healthy targets across available zones. So I'm assuming that the LB is non-discriminative and will just dish-out whatever's available, regardless of where you're from, so long as you're there? If not, shame on you.

Availability Zones and load balancer nodes

We recommend that you enable multiple Availability Zones. (With an Application Load Balancer, we require you to enable multiple Availability Zones.) This configuration helps ensure that the load balancer can continue to route traffic. If one Availability Zone becomes unavailable or has no healthy targets, the load balancer can route traffic to the healthy targets in another Availability Zone.

1

1 Answers

0
votes

Yes traffic can be distributed across subnets if you enable cross-zone loadbalancing.

The way in which traffic is distributed is through the use of a flow-hash algorithm

For TCP traffic, the load balancer selects a target using a flow hash algorithm based on the protocol, source IP address, source port, destination IP address, destination port, and TCP sequence number. The TCP connections from a client have different source ports and sequence numbers, and can be routed to different targets. Each individual TCP connection is routed to a single target for the life of the connection.

More information is available here