📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials AWS Solutions Architect ELB — Elastic Load Balancing

ELB — Elastic Load Balancing

4 min read Quiz at the end
Understand Application, Network, and Gateway Load Balancers. Learn how ALB routing rules and Auto Scaling Groups work together.

ELB — Distributing Traffic Across Servers

A Load Balancer distributes incoming requests across multiple servers so no single server gets overwhelmed. If one server fails, the load balancer automatically stops sending it traffic.

Teacher Note: Imagine a busy restaurant with 4 waiters. The manager (load balancer) assigns tables evenly — if one waiter calls in sick, the manager gives their tables to others. Customers never notice anything is wrong.

Three Types of AWS Load Balancers

Load BalancerLayerKey FeaturesBest For
Application Load Balancer (ALB)Layer 7 (HTTP/HTTPS)Path routing, host routing, WebSockets, gRPC, WAF, Cognito authWeb applications, microservices, REST APIs
Network Load Balancer (NLB)Layer 4 (TCP/UDP)Millions of req/second, ultra-low latency, static IP per AZ, TLS passthroughGaming, trading, IoT, VoIP
Gateway Load Balancer (GWLB)Layer 3 (IP)Routes traffic through 3rd-party virtual appliancesFirewalls, deep packet inspection, IDS/IPS

ALB — Path and Host-Based Routing

ALB Routing Rules:

If URL starts with /api/*  --> Route to Backend API servers
If URL starts with /images/* --> Route to Image servers
If Host is admin.example.com --> Route to Admin servers
If Host is api.example.com  --> Route to API servers

Default: Forward to main application

Auto Scaling with Load Balancers

Combine ALB with Auto Scaling Groups for the most common exam pattern:

  • ALB receives all traffic and distributes it
  • Auto Scaling Group automatically adds EC2 instances when traffic increases
  • Auto Scaling Group removes EC2 instances when traffic decreases
  • New instances are automatically registered with the ALB's Target Group
  • If an instance fails health checks, ALB stops sending it traffic AND ASG replaces it
Exam Tip: ALB vs NLB is a common exam question. Remember: ALB = Layer 7 HTTP/HTTPS, path/host-based routing, WebSockets. NLB = Layer 4 TCP/UDP, static IP, millions of requests per second, ultra-low latency. If the question mentions static IP — it is NLB.
Topic Quiz · 2 questions

Test your understanding before moving on

1. An application uses microservices where /api/* routes to one group of servers and /web/* routes to another. Which load balancer supports this?
💡 ALB operates at Layer 7 and supports path-based routing — routing requests to different target groups based on the URL path.
2. A trading platform requires a static IP address for the load balancer and handles millions of TCP connections per second. Which load balancer is correct?
💡 NLB operates at Layer 4, provides a static IP per AZ, and handles millions of connections per second with ultra-low latency.