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 –
|OSI model layer
|7 and 4
|TCP, UDP, TLS
|HTTP, HTTPS, TCP
|Supports static IP for ELB
|No, only DNS name
|No, only DNS name
|Yes (TLS termination)
|End to end encryption
|No if using SSL offloading
|Cross zone load balancing
|Enabled by default
|Disabled. Enable it manually
|Type of registered targets
|Instance, Lambda, IP
|Websites, web applications
|Application requiring low latency load balancing
|Load balancing or scaling virtual appliances for IDP, firewall etc.
I mentioned the commonly used features comparison above. Amazon published a very good comparison of all load balancers on this page.