Study Guide865 words
AWS Elastic Load Balancing (ELB) Study Guide
Load balancing concepts (for example, ALB)
AWS Elastic Load Balancing (ELB) Study Guide
Learning Objectives
After studying this guide, you should be able to:
- Differentiate between the three primary types of AWS Load Balancers (ALB, NLB, GLB).
- Identify the appropriate OSI layer for each load balancer type.
- Explain how load balancers integrate with EC2 Auto Scaling to ensure High Availability (HA).
- Configure basic path-based and host-based routing rules for an Application Load Balancer.
- Understand the role of health checks in maintaining application reliability.
Key Terms & Glossary
- Listener: A process that checks for connection requests using a specific protocol and port.
- Target Group: A logical grouping of resources (EC2, Lambda, IP addresses) 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. If a target fails, traffic is diverted.
- OSI Model: The Open Systems Interconnection model that characterizes and standardizes the communication functions of a telecommunication or computing system.
- GENEVE Protocol: The encapsulation protocol used primarily by Gateway Load Balancers to route traffic to virtual appliances.
The "Big Idea"
Load balancing is the "Traffic Cop" of your AWS architecture. It provides a single point of entry (DNS name) for your users, shielding them from the complexity of your backend. By distributing incoming requests across multiple healthy targets, it ensures that no single server becomes a bottleneck (Scalability) and that the application remains available even if individual servers fail (High Availability).
Formula / Concept Box
| Feature | Application Load Balancer (ALB) | Network Load Balancer (NLB) | Gateway Load Balancer (GLB) |
|---|---|---|---|
| OSI Layer | Layer 7 (Application) | Layer 4 (Transport) | Layer 3 (Network) |
| Protocols | HTTP, HTTPS, gRPC | TCP, UDP, TLS | IP (GENEVE) |
| Routing Basis | URL Path, Hostname, Cookies | IP Protocol, Port | IP Packets |
| Use Case | Microservices, Web Apps | High performance, Static IPs | Firewalls, Intrusion Detection |
Hierarchical Outline
- I. Introduction to Elastic Load Balancing (ELB)
- A. Purpose: Distribute incoming traffic; provide a single DNS entry.
- B. High Availability: Distributes traffic across multiple Availability Zones (AZs).
- II. Load Balancer Types
- A. Application Load Balancer (ALB)
- Layer 7 visibility (HTTP headers, cookies).
- Ideal for Microservices and container-based apps.
- B. Network Load Balancer (NLB)
- Layer 4 capability (Ultra-low latency).
- Can handle millions of requests per second; supports Static IPs.
- C. Gateway Load Balancer (GLB)
- Layer 3 management for virtual appliances.
- Simplifies deployment of third-party security stacks.
- A. Application Load Balancer (ALB)
- III. Core Components
- A. Listeners & Rules: Define how traffic is processed (e.g., "If Path is /api, go to Target Group B").
- B. Target Groups: Where the traffic ends up (EC2 instances, Containers, etc.).
Visual Anchors
Traffic Flow Diagram
Loading Diagram...
OSI Layer Mapping
Compiling TikZ diagram…
⏳
Running TeX engine…
This may take a few seconds
Definition-Example Pairs
- Path-Based Routing: Routing requests to different target groups based on the URL path.
- Example: Requests to
example.com/imagesgo to an S3-optimized group, whileexample.com/ordersgo to a high-compute group.
- Example: Requests to
- Sticky Sessions (Session Affinity): A mechanism to bind a user's session to a specific target.
- Example: A shopping cart application that stores data locally on the server needs the user to return to the same instance for the duration of their session.
- Cross-Zone Load Balancing: Distributing traffic evenly across all registered targets in all enabled Availability Zones.
- Example: If AZ1 has 2 instances and AZ2 has 8, cross-zone balancing ensures each of the 10 instances receives 10% of the traffic.
Worked Examples
Setting up an ALB for a Multi-Tier Application
- Requirement: You have a web front-end and a separate API back-end.
- Configuration: Create an Application Load Balancer.
- Listener: Add an HTTP listener on Port 80.
- Target Groups:
- Create
TG-Frontend(port 80). - Create
TG-API(port 8080).
- Create
- Rules:
- Default Rule: Forward all traffic to
TG-Frontend. - Path Rule: If
Pathis/api/*, forward toTG-API.
- Default Rule: Forward all traffic to
- Outcome: Users visiting the main site hit the frontend, but any programmatic calls to the API path are transparently routed to the API servers.
Checkpoint Questions
- Which load balancer type should you use if your application requires a single static IP address for its entry point? (Answer: NLB)
- At which OSI layer does the Application Load Balancer operate? (Answer: Layer 7)
- If an EC2 instance fails a health check, what action does the load balancer take? (Answer: It stops sending traffic to that specific instance until it passes a health check again.)
- How does an ALB handle traffic from a domain name like
app.example.comvsdev.example.com? (Answer: Through Host-based routing rules.) - What protocol does the Gateway Load Balancer use to communicate with virtual appliances? (Answer: GENEVE on port 6081.)