A quick post about different types of load balancers in AWS and the difference between them.
AWS offers a load balancing feature under EC2 compute service. It offers basically 4 types of load balancers :
- Application Load Balancer
 - Network Load Balancer
 - Gateway Load Balancer
 - Classic Load Balancer
 
We will quickly go through them one by one and finally compare them with each other.
Application Load Balancer
- It’s a Layer 7 load balancer. Operates at the application layer.
 - Aimed to handle HTTP and HTTPS traffic
 - It is capable of routing based on path patterns.
 - SSL can be offloaded to it. Supports SNI.
 - Even authentications can be offloaded to it.
 - Targets can be EC2, Lambda, and IP addresses.
 - Step by step ALB creation
 
Network Load Balancer
- It’s a layer 4 Load Balancer. Operates at the transport layer.
 - Aimed to handle TCP, UDP, and TLS traffic
 - Uninterrupted end to end encryption till target
 - Ultra-low latency load balancers capable of handling millions of requests per second.
 
Gateway Load Balancer
- It’s a Layer 3 Load Balancer. Operates at the network layer.
 - Aimed to handle virtual appliances traffic on GENEVE protocol.
 - Scale virtual appliances like Firewalls, IDP, etc. using this LB
 
Classic Load Balancer
- It’s a combination of ALB and NLB offered by AWS formerly (with reduced features).
 - New deployments should not be using it.
 - Its existence is only for compatibility for old EC2-Classics running customers.
 
Lets compare all 4 Elastic Load Balancers side by side –
| ALB | NLB | GLB | CLB | |
|---|---|---|---|---|
| OSI model layer | 7 | 4 | 3 | 7 and 4 | 
| Protocol supported | HTTP, HTTPS | TCP, UDP, TLS | GENEVE | HTTP, HTTPS, TCP | 
| Supports static IP for ELB | No, only DNS name | Yes | No | No, only DNS name | 
| SSL offloading | Yes | Yes (TLS termination) | No | Yes | 
| SNI support | Yes | Yes | No | No | 
| Authentication offloading | Yes | No | No | No | 
| End to end encryption | No if using SSL offloading | Yes | No | Yes | 
| Sticky sessions | Yes | Yes | Yes | Yes | 
| Path patterns | Yes | |||
| Cross zone load balancing | Enabled by default | Yes | Yes | Disabled. Enable it manually | 
| Type of registered targets | Instance, Lambda, IP | Instance, IP | Instance, IP | Instance,IP | 
| Use cases | Websites, web applications | Application requiring low latency load balancing | Load balancing or scaling virtual appliances for IDP, firewall etc. | Web applications. | 
I mentioned the commonly used features comparison above. Amazon published a very good comparison of all load balancers on this page.
