Elastic Load Balancing (ELB) Basics
Understand how Elastic Load Balancing improves application availability and fault tolerance by distributing traffic across multiple targets.
All services used in this lesson are covered by the AWS Free Tier.
AWS Services Used
Learning outcomes
By the end of this lesson, you will be able to:
- Explain what Elastic Load Balancing does.
- Explain why load balancers improve availability and fault tolerance.
- Recognize the main AWS load balancer types: Application Load Balancer, Network Load Balancer, Gateway Load Balancer, and Classic Load Balancer.
- Identify which load balancer type is the best first focus.
- Understand the roles of listeners, target groups, and health checks.
What a load balancer does
A load balancer sits in front of your servers and spreads incoming traffic across multiple healthy targets. AWS says this increases application availability and fault tolerance, lets you add or remove compute resources without disrupting traffic, and scales load balancer capacity automatically as traffic changes.
A simple memory rule:
- One public front door
- Multiple backend targets
- Healthy targets get traffic
- Unhealthy targets do not
1) Why load balancers matter
AWS says a load balancer distributes workloads across multiple compute resources and increases availability and fault tolerance. It also lets you add and remove compute resources as your needs change, without disrupting the overall request flow.
- Single Server: If that one server fails, your whole app is down (Single Point of Failure).
- Load Balancer + Multiple Targets: Even if one server crashes, the load balancer automatically sends traffic to the remaining healthy servers.
2) The three core concepts
For most load balancer questions, remember these three parts:
A) Listener
A listener waits for client connections on a protocol and port you choose, such as HTTP on port 80 or HTTPS on port 443.
B) Target group
A target group contains the backend targets that will receive requests. These can include EC2 instances, IP addresses, containers, and in some cases Lambda functions.
C) Health checks
Health checks monitor whether registered targets are healthy. The load balancer sends traffic only to healthy targets.
3) Main AWS load balancer types
AWS supports four load balancer types, but two are the primary focus when you're getting started.
A) Application Load Balancer (ALB)
ALB works at the application layer (Layer 7). It is "smart" because it can route traffic based on content like paths or hostnames.
- Best for: Websites, APIs, and modern web apps.
- Mental Model: Smart HTTP/HTTPS routing.
B) Network Load Balancer (NLB)
NLB works at the transport layer (Layer 4). It can handle millions of requests per second with extremely low latency.
- Best for: Very high-performance TCP, UDP, and TLS traffic.
- Mental Model: Fast, high-volume network traffic.
C) Gateway Load Balancer (GWLB)
Used for deploying and scaling virtual appliances like firewalls or intrusion detection systems.
- Mental Model: Network/security appliance traffic.
D) Classic Load Balancer (CLB)
The previous generation of Elastic Load Balancing. AWS recommends migrating to current-generation load balancers.
- Mental Model: Legacy generation.
4) ELB and Auto Scaling work together
Elastic Load Balancing works seamlessly with Amazon EC2 Auto Scaling.
- Load Balancer = Spreads the traffic.
- Auto Scaling = Changes how many instances exist based on demand. Together, they form a common high-availability pattern on AWS.
Micro-activity 1: Match the Load Balancer
Load Balancer Types
Match each load balancer type to its primary use case.
Examples
Choose one, then match it on the right
Characteristics
Select an example first
0 of 4 matched so far.
Micro-activity 2: Component Roles
ELB Components
What is the role of each ELB component?
Examples
Choose one, then match it on the right
Characteristics
Select an example first
0 of 4 matched so far.
Summary
Elastic Load Balancing automatically distributes incoming traffic across multiple targets and monitors their health. The Application Load Balancer is the best starting point because it's built for web applications. The main pattern to remember is: listeners receive traffic, rules send it to target groups, and health checks keep traffic away from unhealthy targets.
Knowledge Check
Next lesson
Lesson 4.6: Auto Scaling Basics