Mastering AWS Elastic Load Balancing (ELB) & Application Load Balancers
Load balancing concepts (for example, Application Load Balancer)
Mastering AWS Elastic Load Balancing (ELB) & Application Load Balancers
This study guide covers the core concepts of load balancing within the AWS ecosystem, focusing on the Application Load Balancer (ALB) and its role in designing resilient, high-performing architectures for the SAA-C03 exam.
Learning Objectives
After studying this guide, you should be able to:
- Distinguish between the three modern types of Elastic Load Balancers (ALB, NLB, GWLB).
- Explain the difference between Layer 4 (Transport) and Layer 7 (Application) load balancing.
- Describe how load balancers integrate with Auto Scaling to provide high availability.
- Identify the routing criteria used by Application Load Balancers (e.g., path-based, host-based).
- Understand the mechanism of health checks and failover in maintaining application reliability.
Key Terms & Glossary
- Listener: A process that checks for connection requests using a configured protocol and port.
- Target Group: A logical grouping of targets (like EC2 instances) to which the load balancer routes traffic.
- Health Check: A periodic ping or request sent by the load balancer to targets to ensure they are responding correctly.
- Stickiness (Session Affinity): A feature that binds a user's session to a specific target so that all requests from that user during the session are sent to the same target.
- OSI Model: The Open Systems Interconnection model that characterizes and standardizes the communication functions of a telecommunication or computing system.
The "Big Idea"
[!IMPORTANT] The Big Idea: Load balancing is the "traffic cop" of the cloud. By decoupling the entry point (DNS name) from the backend compute resources, it enables horizontal scaling and fault tolerance. If one server fails, the load balancer automatically redirects traffic to healthy ones, ensuring the user experience remains uninterrupted.
Formula / Concept Box
| Feature | Application Load Balancer (ALB) | Network Load Balancer (NLB) | Gateway Load Balancer (GWLB) |
|---|---|---|---|
| OSI Layer | Layer 7 (Application) | Layer 4 (Transport) | Layer 3 (Network) |
| Protocols | HTTP, HTTPS, gRPC | TCP, UDP, TLS | IP (GENEVE encapsulation) |
| Routing Basis | URL Path, Hostname, Query Strings | IP Address, Port, Protocol | IP Packets |
| Ideal Use Case | Microservices, Web Apps | Ultra-high performance, Static IPs | 3rd party Virtual Appliances |
Hierarchical Outline
- I. Introduction to Elastic Load Balancing (ELB)
- Software-based Service: Sits in front of infrastructure to manage incoming requests.
- DNS Integration: Associate a domain (Route 53) with the ELB address rather than a single instance.
- II. Application Load Balancer (ALB) Deep Dive
- Path-based Routing: Route
/imagesto one target group and/apito another. - Host-based Routing: Route
example.comvsapp.example.comto different groups. - Security: Supports SSL/TLS termination to offload encryption work from web servers.
- Path-based Routing: Route
- III. Operational Mechanics
- Health Checks: Monitors target status; automatically stops routing to "unhealthy" nodes.
- Auto Scaling Integration: Automatically registers new instances and de-registers terminated ones.
- Multi-AZ Availability: Distributes traffic across multiple Availability Zones to prevent regional outages.
Visual Anchors
Traffic Flow Diagram
OSI Layer Mapping
\begin{tikzpicture} \draw[thick] (0,0) rectangle (6,1) node[midway] {Layer 3: Network (GWLB - IP)}; \draw[thick] (0,1.2) rectangle (6,2.2) node[midway] {Layer 4: Transport (NLB - TCP/UDP)}; \draw[thick, fill=blue!10] (0,2.4) rectangle (6,3.4) node[midway] {Layer 7: Application (ALB - HTTP)}; \draw[->, thick] (7,3.4) -- (7,0) node[midway, right] {Increasing Granularity}; \end{tikzpicture}
Definition-Example Pairs
- Path-based Routing: Routing traffic based on the URL string after the domain name.
- Example: A streaming site routes
movies.com/browseto a fleet of lightweight web servers but routesmovies.com/streamto a fleet of high-performance compute instances.
- Example: A streaming site routes
- Connection Multiplexing: A technique where the ALB uses a single connection to the backend for multiple front-end requests.
- Example: This reduces the overhead on backend servers, allowing a web server to handle thousands of users with fewer open sockets.
- Failover Architecture: The ability to automatically switch to a redundant or standby system upon the failure of the primary component.
- Example: If an entire Availability Zone goes offline, the Load Balancer detects the failure and shifts 100% of the traffic to the healthy instances in the remaining zones.
Worked Examples
Scenario: Configuring a Simple Web Load Balancer
- Requirement: You have two web servers in different subnets and want to distribute traffic evenly.
- Step 1: Create Target Group: Define a target group named
web-tg, set the protocol to HTTP (Port 80), and perform health checks on/index.html. - Step 2: Register Targets: Manually or automatically (via Auto Scaling) add the private IP addresses or Instance IDs of the two web servers to
web-tg. - Step 3: Create ALB: Choose an "Internet-facing" scheme. Select at least two Availability Zones for high availability.
- Step 4: Configure Listener: Add a listener for HTTP on Port 80. Set the default action to "Forward to
web-tg." - Result: Users access the ALB's DNS name. The ALB checks the health of the servers and sends the user to Server A or Server B based on capacity and health.
Checkpoint Questions
- Which load balancer type is best suited for a legacy application using a non-HTTP custom protocol over TCP?
- What happens to a request if an ALB performs a health check and finds a target is "Unhealthy"?
- True or False: An Application Load Balancer can route traffic based on the query string in a URL.
- How does the integration of Auto Scaling and ELB improve reliability during an instance failure?
▶Click to reveal answers
- Network Load Balancer (NLB), as it operates at Layer 4 and handles TCP traffic.
- The ALB stops routing traffic to that specific target until it passes a subsequent health check.
- True. ALBs can route based on hostnames, paths, query strings, and HTTP headers.
- Auto Scaling detects the failure, terminates the instance, launches a new one, and automatically registers it with the Load Balancer's target group.