Classic Load Balancers (v1)
Supports TCP (Layer 4), HTTP & HTTPS (Layer 7)
Health checks are TCP or HTTP based
Fixed hostname XXX.region.elb.amazonaws.com
Application Load Balancer (v2)
Application load balancers is Layer 7 (HTTP)
Load balancing to multiple HTTP applications across machines (target groups)
Load balancing to multiple applications on the same machine (ex: containers)
Support for HTTP/2 and WebSocket
Supports redirects (from HTTP to HTTPS for example)
Routing tables to different target groups:
- Routing base on path in URL (example.com/users & example.com/posts)
- Routing base on hostname in URL (one.example.com & other.example.com)
- Routing base on Query String, Headers (example.com/users?id=123&order=false)
Has a port mapping feature to redirect to a dynamic port in ECS
In comparison, we’d need multiple Classic Load Balancer per application
ALB (v2) HTTP Based Traffic
ALB (v2) Target Groups
EC2 instances (can be managed by an Auto Scaling Group) - HTTP
ECS tasks (managed by ECS itself) - HTTP
Lambda functions - HTTP request is translated into a JSON event
IP Addresses - must be private IPs
ALB can route to multiple target groups
Health checks are at the target group level
Network Load Balancer (v2)
Network load balancers (Layer 4) allow to:
- Forward TCP & UDP traffic to your instances
- Handle millions of request per seconds
- Less latency ~ 100ms (vs 400 ms for ALB)
NLB has one static IP per AZ, and supports assigning Elastic IP(helpful for whitelisting specific IP)
NLB are used for extreme performance, TCP or UDP traffic
Not included in the AWS free tier
Network Load Balancer (v2) TCP (Layer 4) Based Traffic
Network Load Balancer - Target Groups
EC2 instances
IP Addresses - must be private IPs
Application Load Balancer
Health Checks support the TCP, HTTP and HTTPS protocols
Gateway Load Balancer
Deploy, scale, and manage a fleet of 3rd party network virtual applications in AWS Example: Firewalls, Intrusion Detection and Prevention Systems, Deep Packet Inspect Inspection Systems, payload manipulation, …
Operates at Layer 3 (Network Layer) - IP Packages
Combines the following fuctions:
- Transparent Network Gateway - single entry/exit for all traffic
- Load Balancer - distributes traffic to your virtual applications
- Uses the GENEVE protocol on port 6081
Gateway Load Balancer Network Layer (Layer 3) Based Traffic
Gateway Load Balancer - Target Group
EC2 instances
IP Addresses - must be private IPs