1Layer 7 vs Layer 4
ALB unpacks HTTP packets, allowing intelligent routing. NLB simply forwards TCP streams, making it insanely fast.
2Step-by-Step Breakdown
What is ELB?. Elastic Load Balancing distributes incoming traffic across multiple targets to increase availability.
Application Load Balancer (ALB). Operates at Layer 7 (HTTP/HTTPS). Ideal for modern web apps and microservices.
Path-Based Routing. ALB can route /api to one set of instances and /blog to another.
Network Load Balancer (NLB). Operates at Layer 4 (TCP/UDP). Used for ultra-high performance and low latency.
Knowledge Check. Which load balancer operates at Layer 7 and supports HTTP path routing?
- →Network Load Balancer
- →Application Load Balancer
Static IPs. NLBs provide a static IP per AZ, whereas ALBs provide a DNS name that resolves to changing IPs.
Target Groups. Load balancers route requests to Target Groups, which contain EC2 instances, IP addresses, or Lambdas.
Health Checks. ELB continually monitors the health of targets. Unhealthy instances are taken out of rotation.
SSL Termination. ALBs can handle SSL/TLS decryption using AWS Certificate Manager (ACM).
Summary. Use ALB for web apps, NLB for raw TCP performance.
