SureSkills Blog & Resources

AWS Load Balancers

Written by Calvin Riskowitz | Feb 20, 2024 12:09:24 PM

In AWS the principals of resilience and high availability are paramount in your design, implementation, and use of deployed resources. Today I’d like to dive a little deeper into the AWS Elastic Load Balancer (ELB).
In complying with these design principles, we would wish to deploy our services and resources into an AWS network or VPC (Virtual Private Cloud) using a minimum of two Availability Zones (AZ’s).

{An Availability Zone (AZ) is one or more discrete data centres with redundant power, networking, and connectivity in an AWS Region. AZ’s give customers the ability to operate production applications and databases that are more highly available, fault tolerant, and scalable than would be possible from a single data centre. All AZ’s in an AWS Region are interconnected with high-bandwidth, low-latency networking, over fully redundant, dedicated metro fibre providing high-throughput, low-latency networking between AZ’s. All traffic between AZ’s is encrypted. The network performance is sufficient to accomplish synchronous replication between AZ’s}

Let’s say that we needed 6 server instances to handle the predicted load, then this deployment would meet with these principles:

The problem is how to deliver network traffic equally to all six server instances.  The most common approach is to register all six instances IP addresses with a Domain Name Service (DNS like AWS Route53) and to select an appropriate load balancing option (or distribution technique).  While this option is effective, it has several drawbacks – namely: Its typically a manual process with no (or limited) health checks of the backend servers.

With AWS we have the option of deploying a managed Load Balancing Service (the Elastic Load Balancer) which can then direct inbound network traffic to the appropriate server instances. All that is required is for you to register the nodes (IP addresses) of the Elastic Load balancer with your DNS service.

The Amazon Elastic Load Balancer is a service that automatically distributes incoming application traffic across multiple Amazon EC2 instances. You can use it to achieve even greater fault tolerance in your applications. It seamlessly provides the amount of load balancing capacity needed in response to incoming application traffic. Elastic Load Balancing detects unhealthy instances within a pool and automatically reroutes traffic to healthy instances until the unhealthy instances have been restored. {Health checks – ELB load balancers can detect unhealthy targets, stop sending traffic to them, and spread the load across the remaining healthy targets.}

There are a four Elastic Load Balancer types, the most common two being the Network Load Balancer (NLB) and the Application Load Balancer (ALB). If you need to load balance HTTP/HTTPS requests, AWS recommends that you use the Application Load Balancer (ALB). For network or transport protocols (ie: layer4 - TCP, UDP) and/or for extreme performance or low latency applications, we recommend using Network Load Balancer (NLB).

There is one important caveat to be aware of, and that is the load balancing distribution technique that has a different default setting between the ALB and NLB. With the Network Load Balancer (NLB), cross-zone load balancing is turned OFF by default, the default is round robin load balancing. You can turn on Cross-Zone Loading Balancing (CZLB) only after creating your Network Load Balancer. {Edit the load balancing attributes section and then select the CZLB support check box}. With the Application Load Balancer (ALB), cross-zone load balancing is ON by default, but can be turned off. (Turning off CZLB is possible at the target group level.)

So, what would be the net effect of an instance failing on the load balancing traffic distribution if each type of Elastic Load Balancer was configured for its default setting?

Based on the Round Robin routing algorithm, traffic is distributed such that each load balancer node receives 50% of the traffic from the clients (inbound network traffic). Each load balancer node distributes its share of the traffic across the registered targets in its scope (resulting in the distribution percentages below).

If cross-zone load balancing is enabled, each of the 5 targets receives 20% of the traffic. This calculation is because each load balancer node can route its 50 percent of the client traffic to all 5 targets (resulting in the distribution percentages below).

As you can see – selecting the right load balancing option can make a significant different in the distribution of inbound network traffic (or client requests).


If this has piqued your interest – perhaps now is a good time to get some Instructor Led Training with our hands on practical labs.  We have a new intensive 1 day “Networking Essentials for Cloud Applications on AWS” course if you just need some network knowledge or our hugely popular 3 day “Architecting on AWS” course.

#AWS   #SureSkills    #cloud   #networking