Introduction to Cloud Load-Balancers
Tags: aws, cloud, architecture, design
Published: 2023-03-13 18:33:12

We have been using load-balancing technology for many years.  
What is the purpose of load-balancers and what are the alternatives offered as managed services by the public cloud providers?  

## Terminology
Below are some important concepts regarding cloud load-balancers:  
* Private / Internal Load-Balancer – A load-balancer serving internal traffic (such as traffic from public websites to a back-end database)  
* Public / External Load-Balancer – A load-balancer that exposes a public IP and serves external traffic (such as traffic from customers on the public Internet to an external website)  
* Regional Load-Balancer – A load-balancer that is limited to a specific region of the cloud provider  
* Global Load-Balancer – A load-balancer serving customers from multiple regions around the world using a single public IP  
* TLS Termination / Offloading – A process where a load-balancer decrypt encrypted incoming traffic, for further analysis (such as traffic inspection) and either pass the traffic to the back-end nodes decrypted (offloading the encrypted traffic) or pass the traffic encrypted to the back-end nodes  

## What are the benefits of using load balancers?
Load-balancers offer our applications the following benefits:  
* Increased scalability – combined with "auto-scale" we can benefit from the built-in elasticity of cloud services, allowing us to increase or decrease the amount of compute services (such as VMs, containers, and database instances) according to our application's load  
* Redundancy – load-balancers allow us to send traffic to multiple back-end servers (or containers), and in case of a failure in a specific back-end node, the load-balancer will send traffic to other healthy nodes, allowing our service to continue serving customers  
* Reduce downtime – consider a scenario where we need to schedule maintenance work (such as software upgrades in a stateful architecture), using a load-balancer, we can remove a single back-end server (or container), drain the incoming traffic, and send new customers' requests to other back-end nodes, without affecting the service  
* Increase performance – assuming our service suffers from a peak in traffic, adding more back-end nodes will allow us a better performance to serve our customers  
* Manage failures – one of the key features of a load-balancer is the ability to check the health status of the back-end nodes, and in case one of the nodes does not respond (or function as expected), the load-balancer will not send new traffic to the failed node  

## Layer 4 Load-Balancers
The most common load-balancers operate at layer 4 of the OSI model (the network/transport layer), and usually, we refer to them as network load-balancers.  
The main benefit of a network load balancer is extreme network performance.  
Let us compare the cloud providers' alternatives:  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh0cvicmny9l5xfj4g5d.JPG)

### Additional reference
* What is a Network Load Balancer?  
[https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html)  

## Layer 7 Load-Balancers
When we need to load balance modern applications traffic, we use application load balancers, which operate at layer 7 of the OSI model (the application layer).  
Layer 7 load-balancers have an application awareness, meaning you can configure routing rules to route traffic to two different versions of the same application (using the same DNS name), but with different URLs.  
Let us compare the cloud providers' alternatives:  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l7yjfdj22s87w7fm417t.JPG)

### Additional reference
* What is an Application Load Balancer?  
[https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html)  

## Global Load-Balancers
Although only Google has a native global load balancer, both AWS and Azure have alternatives, which allow us to configure a multi-region architecture serving customers from multiple regions around the world.  
Let us compare the cloud providers' alternatives:  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wgjzqhnm9gkqqgpjyvq.JPG)


### Additional reference
* What is AWS Global Accelerator?  
[https://docs.aws.amazon.com/global-accelerator/latest/dg/what-is-global-accelerator.html](https://docs.aws.amazon.com/global-accelerator/latest/dg/what-is-global-accelerator.html)  

## Summary
In this blog post, we have reviewed why we need cloud load balancers when designing scalable and highly available architectures.  
We reviewed the different types of managed cloud load balancers and compared the hyper-scale public cloud providers and their various capabilities.  
When designing a modern application, considering network aspects (such as internal, external, or even global availability requirements), will allow you better application performance, availability, and customer experience.  

### Additional reference
* AWS Elastic Load Balancing features  
[https://aws.amazon.com/elasticloadbalancing/features](https://aws.amazon.com/elasticloadbalancing/features)  

### About the Author
Eyal Estrin is a cloud and information security architect, the owner of the blog [Security & Cloud 24/7](https://security-24-7.com/) and the author of the book [Cloud Security Handbook](https://amzn.to/3xMI4Ak), with more than 20 years in the IT industry.  
Eyal is an [AWS Community Builder](https://aws.amazon.com/developer/community/community-builders/) since 2020.  
You can connect with him on [Twitter](https://twitter.com/eyalestrin) and [LinkedIn](https://www.linkedin.com/in/eyalestrin/).