Amazon ELB: The Complete Beginner's Guide to Load Balancing
When millions of people try to visit the same website at once, no single server on Earth can handle them all alone. Elastic Load Balancing is AWS's traffic cop — the service that spreads incoming requests across many servers so no single one ever gets overwhelmed.
Picture a single checkout lane at a grocery store on the busiest shopping day of the year. No matter how fast that one cashier works, a line will form out the door. Now picture a manager standing at the entrance, glancing at every lane, and directing each new shopper to whichever cashier is currently free. That manager is doing exactly what Elastic Load Balancing does for websites and applications — except instead of shoppers, it’s directing web requests, and instead of cashiers, it’s directing traffic to servers. This guide starts from zero and builds up to the level you’d need for a real project or an AWS certification exam.
1Core Concepts
Before we can talk about Elastic Load Balancing, we need to understand the basic problem it exists to solve: what happens when one server isn’t enough.
What Is Load Balancing?
Load balancing is the practice of distributing incoming network traffic across multiple servers so that no single server has to handle all the work alone. Without it, a popular application would either need one impossibly powerful server, or it would simply slow to a crawl — or crash — under heavy demand. Load balancing also provides a second, equally important benefit: if one server fails, traffic can be automatically redirected to the servers that are still healthy, so users never even notice.
Think of a busy restaurant with only one waiter versus one with a host who seats guests across many waiters based on who has room. The single-waiter restaurant collapses the moment it gets popular — orders get missed, food arrives cold, some tables never get served. The host, by comparison, keeps the whole restaurant running smoothly no matter how many guests walk in, and if one waiter calls in sick, the host simply stops sending tables their way.
What Is Amazon Elastic Load Balancing (ELB)?
Amazon Elastic Load Balancing is a fully managed AWS service that automatically distributes incoming application traffic across multiple targets, such as EC2 instances, containers, or IP addresses, in one or more Availability Zones. “Fully managed” means AWS operates, scales, and patches the load balancer itself, so your team never has to install load-balancing software or worry about the load balancer becoming a bottleneck on its own. Companies like Airbnb and Netflix rely on this kind of automatic traffic distribution to keep their websites responsive even during massive spikes, such as a flash sale or a new show release, without any engineer manually redirecting traffic in the moment.
The Four Types of AWS Load Balancers
AWS offers four distinct load balancer types, each tuned for a different layer of network traffic and a different kind of application:
Application Load Balancer (ALB)
Operates at the application layer (HTTP/HTTPS), understanding URLs and headers so it can route based on content, like sending “/images” traffic to one set of servers and “/api” to another.
Network Load Balancer (NLB)
Operates at the transport layer (TCP/UDP), designed for extreme performance and the ability to preserve a client’s original IP address.
Classic Load Balancer (CLB)
The original AWS load balancer, offering basic Layer 4 and Layer 7 features, now mostly used only by long-standing applications built before ALB and NLB existed.
Gateway Load Balancer (GWLB)
Designed to deploy and scale third-party virtual security appliances, such as firewalls, transparently in front of application traffic.
“Why would AWS build four separate load balancer types instead of one universal one?” A strong answer: each type solves a genuinely different networking problem — content-aware routing for web apps, raw speed and IP preservation for high-throughput systems, and transparent traffic inspection for security appliances — so a single generic design would compromise all three use cases at once.
2Architecture & Components
An Elastic Load Balancer is built from a small number of clearly defined pieces working together, regardless of which type you choose.
The Building Blocks
- Load Balancer — the front door that receives all incoming traffic before it reaches any application server.
- Listener — a configuration that checks for connection requests on a specific protocol and port, such as HTTPS on port 443.
- Target Group — a logical collection of servers (targets) that the load balancer routes requests to.
- Health Checks — periodic pings the load balancer sends to each target to confirm it’s still capable of handling traffic.
- Rules — conditions attached to a listener that decide which target group a given request should go to, based on things like the URL path.
flowchart TB
USER["Users on the Internet"] --> ELB["Elastic Load Balancer
(Listener on port 443)"]
ELB -->|"Rule: /api/*"| TG1["Target Group A
(API Servers)"]
ELB -->|"Rule: /images/*"| TG2["Target Group B
(Image Servers)"]
subgraph AZ1["Availability Zone A"]
TG1
S1["EC2 Instance 1"]
S2["EC2 Instance 2"]
end
subgraph AZ2["Availability Zone B"]
TG2
S3["EC2 Instance 3"]
S4["EC2 Instance 4"]
end
TG1 --> S1
TG1 --> S2
TG2 --> S3
TG2 --> S4
ELB -.->|"Health checks"| S1
ELB -.->|"Health checks"| S2
ELB -.->|"Health checks"| S3
ELB -.->|"Health checks"| S4
Fig 1 — A single Application Load Balancer routing different URL paths to different target groups spread across Availability Zones.
Where ELB Fits Inside AWS
Elastic Load Balancing typically sits at the very front of an application’s architecture, directly behind Amazon Route 53 (DNS) and in front of Amazon EC2 instances, containers running on Amazon ECS or EKS, or AWS Lambda functions. A common pattern pairs an Application Load Balancer with an Auto Scaling group, so that as the load balancer detects rising traffic, new EC2 instances are automatically launched and registered as new targets, and the load balancer immediately begins sending them traffic.
| Load Balancer Type | OSI Layer | Best For |
|---|---|---|
| Application Load Balancer | Layer 7 (HTTP/HTTPS) | Web apps needing content-based routing |
| Network Load Balancer | Layer 4 (TCP/UDP) | Extreme performance and static IP requirements |
| Gateway Load Balancer | Layer 3/4 | Deploying third-party security appliances |
| Classic Load Balancer | Layer 4/7 (legacy) | Older applications predating ALB and NLB |
3Internal Working
What actually happens between the moment a user’s browser sends a request and the moment a specific server responds?
Step by Step: Handling a Request
A request arrives at the load balancer
The user’s browser connects to the load balancer’s DNS name, which resolves to one of several load balancer nodes spread across Availability Zones.
The listener inspects the request
It checks the protocol and port, and for an ALB, it can also inspect the URL path, hostname, or headers.
Routing rules select a target group
Based on the configured rules, the load balancer decides which group of servers should handle this specific request.
A healthy target is chosen
The load balancer picks a specific server within the target group, using an algorithm like round robin, skipping any server currently failing its health checks.
The response returns to the user
The chosen server processes the request and sends its response back through the load balancer to the user, who never sees which specific server handled it.
Health checks work like a restaurant host periodically peeking into the kitchen to make sure each cook is still standing and cooking. If one cook has stepped away or is overwhelmed, the host simply stops sending new orders their way until they signal they’re ready again — customers keep getting served without ever knowing one cook was temporarily out of action.
How Health Checks Actually Work
A health check is a small, repeated request the load balancer sends to each registered target — often a simple HTTP request to a designated path like “/health.” If a target responds successfully a configured number of times in a row, it’s marked healthy and receives traffic. If it fails a configured number of times in a row, it’s marked unhealthy and is automatically removed from rotation until it starts passing again, all without any human intervention.
4Data Flow & Lifecycle
Traffic flowing through a load balancer follows a predictable lifecycle from request to response, and targets themselves have their own lifecycle of joining and leaving rotation.
The Lifecycle of a Target
A server doesn’t simply appear in front of user traffic the instant it launches. It’s first registered with a target group, then it enters an “initial” state while health checks run, then it becomes “healthy” and starts receiving traffic, and eventually it may be deregistered — for example, when an Auto Scaling group decides to remove it during a scale-in event. AWS supports “connection draining” (also called deregistration delay), which gives in-flight requests time to finish before a target is fully removed, so a user’s checkout doesn’t get abruptly cut off mid-transaction.
sequenceDiagram
participant AutoScaling as Auto Scaling Group
participant ELB as Elastic Load Balancer
participant Target as New EC2 Instance
participant User as End User
AutoScaling->>Target: Launch new instance
AutoScaling->>ELB: Register instance with target group
ELB->>Target: Send health checks
Target-->>ELB: Healthy response
ELB->>Target: Begin routing live traffic
User->>ELB: Send request
ELB->>Target: Forward request
Target-->>User: Return response
Fig 2 — A new instance progresses from launch, to registration, to health checks, to finally receiving live traffic.
Sticky Sessions
Some applications need a returning user to keep hitting the same server, for example, when session data is stored only in that one server’s memory. ELB supports “sticky sessions,” using a cookie to remember which target a specific user was last sent to, and routing their future requests back to that same target whenever possible.
5Advantages, Disadvantages & Trade-offs
Load balancing solves real problems, but it isn’t free of trade-offs — understanding both sides is exactly what interviewers look for.
Advantages
- Automatically distributes traffic, preventing any one server from being overwhelmed
- Removes unhealthy targets from rotation without manual intervention
- Scales automatically with traffic, with no capacity you need to pre-provision
- Enables zero-downtime deployments by gradually shifting traffic to new versions
- Provides a single, stable entry point even as backend servers change constantly
Disadvantages
- Adds a small amount of network latency compared to connecting directly to a server
- Misconfigured health checks can mistakenly remove perfectly healthy targets
- Sticky sessions can create uneven load distribution if overused
- Choosing the wrong load balancer type for a workload can limit features or performance
The Core Trade-off: Simplicity vs. Control
Running your own reverse proxy or load-balancing software gives you complete control over every routing decision, but it also means you own patching that software, scaling it during traffic spikes, and keeping it highly available itself. Amazon ELB trades a small amount of low-level control for AWS guaranteeing that the load balancer itself never becomes the single point of failure it’s meant to protect against.
6Performance & Scalability
A load balancer that can’t scale itself would defeat its entire purpose — so ELB is built to grow automatically alongside demand.
Automatic Scaling of the Load Balancer Itself
Unlike a single server with a fixed capacity ceiling, Elastic Load Balancing automatically provisions additional capacity behind the scenes as traffic grows, adding more load balancer nodes across Availability Zones without any action from you. This is similar to a stadium that can magically add more ticket-checking gates the moment a line starts forming, rather than making everyone squeeze through the same fixed number of doors no matter how big the crowd gets.
Scaling in Practice
A ticket-sales company expecting a massive spike the moment a popular concert goes on sale might pair an Application Load Balancer with an Auto Scaling group configured to react quickly to rising request counts — as the load balancer’s metrics show increasing traffic, new EC2 instances launch and register within minutes, all coordinated automatically without an engineer manually adding capacity in the middle of the rush.
“Can the load balancer itself ever become the bottleneck?” A strong answer: because ELB scales its own capacity automatically behind a stable DNS name, it’s designed specifically to avoid becoming the bottleneck, though sudden extreme traffic spikes may still benefit from AWS being notified in advance so it can pre-warm additional capacity.
7High Availability & Reliability
A load balancer’s entire job is to protect an application from a single point of failure — so it needs to avoid becoming one itself.
Spreading Across Availability Zones
Elastic Load Balancing is designed to operate across multiple Availability Zones simultaneously. You register targets from more than one Availability Zone, and the load balancer distributes traffic across all of them, so if an entire data center location experiences an outage, traffic simply continues flowing to the healthy targets in the remaining zones.
Real-World Pattern
An online banking platform running its web tier behind an Application Load Balancer spread across three Availability Zones can lose an entire data center and continue serving customer logins without a single dropped session, because the load balancer simply stops routing to the affected zone.
Durability vs. Availability
In the context of load balancing, availability is really the central concern — the load balancer holds no persistent data of its own to keep durable, but it must remain reachable and correctly routing traffic at all times. Amazon achieves this through redundant load balancer nodes, health checks, and cross-zone traffic distribution, so the loss of any single component doesn’t take down the front door to your entire application.
8Security
Because a load balancer sits at the very front of your application, it’s also naturally your first line of defense.
- Security groups — control exactly which sources are permitted to send traffic to the load balancer in the first place.
- SSL/TLS termination — the load balancer can handle encryption and decryption of HTTPS traffic, offloading that work from your application servers.
- Integration with AWS WAF — the AWS Web Application Firewall can be attached to an Application Load Balancer to block common web attacks before they ever reach your servers.
- Private, internal load balancers — an ELB can be configured to only accept traffic from within your VPC, keeping internal services hidden from the public internet entirely.
- Access logs — detailed logs of every request can be stored in Amazon S3 for later security analysis or auditing.
SSL termination at the load balancer is like a building’s front security desk checking every visitor’s ID once at the entrance, rather than requiring every single office on every floor to re-check IDs all over again. It’s more efficient, and it means every floor can trust that whoever reaches them has already been verified.
Assuming that placing a load balancer in front of your servers automatically makes them secure. Security groups on both the load balancer and the backend targets still need to be deliberately configured, and backend servers should typically only accept traffic from the load balancer itself, not directly from the internet.
9Monitoring, Logging & Metrics
Since every single request to your application passes through it, a load balancer is one of the richest sources of operational insight you have.
Amazon ELB integrates with Amazon CloudWatch, continuously reporting metrics like request count, target response time, and the number of healthy versus unhealthy targets. Think of these metrics like the vital signs a doctor checks during a routine exam — individually simple numbers, but together they tell a clear story about overall health. Teams commonly set an alarm on the “unhealthy host count” metric so that if targets start failing health checks, someone is alerted before the remaining healthy servers become overwhelmed by the extra load.
Request Count
Tracks the total number of requests processed, useful for understanding traffic patterns and planning capacity.
Target Response Time
Measures how long backend servers take to respond, helping catch slow application code before users complain.
Healthy/Unhealthy Host Count
Shows exactly how many targets are currently in and out of rotation, a direct signal of backend fleet health.
HTTP Error Codes
Breaks down 4xx and 5xx response counts, helping distinguish client-side mistakes from server-side failures.
10Deployment & Cloud Integration
Elastic Load Balancing rarely operates alone — its real power shows up in how it connects the rest of an application’s architecture together.
A common deployment pattern places an Application Load Balancer in front of an Auto Scaling group of EC2 instances, so the two services work as a coordinated pair: the load balancer distributes traffic and reports health, while Auto Scaling reacts to that traffic by adding or removing capacity. Teams running containerized applications on Amazon ECS or Amazon EKS similarly register containers as ELB targets, letting the load balancer route traffic to whichever containers are currently running, even as those containers are replaced during routine deployments.
Real-World Pattern
A company performing a “blue-green deployment” — running a new application version alongside the old one — can use an Application Load Balancer’s weighted target groups to gradually shift a small percentage of live traffic to the new version, watching metrics closely before shifting the rest, all without any user-visible downtime.
Cost Considerations During Deployment
Amazon ELB bills based on the hours the load balancer runs plus a measure of the traffic it processes, similar to how a toll road charges a base fee plus a per-vehicle charge. A common beginner mistake is provisioning many small, separate load balancers for different services when a single Application Load Balancer using path-based routing rules could serve all of them at a lower combined cost.
Integration with Serverless Architectures
Elastic Load Balancing isn’t limited to traditional servers. An Application Load Balancer can route traffic directly to AWS Lambda functions as targets, letting a team expose a serverless backend through the same familiar load balancing layer used for EC2-based applications. This is particularly useful when migrating an application gradually from servers to serverless — the load balancer can send some paths to Lambda functions and others to EC2 targets during the transition, so users never notice which underlying technology is answering their request.
11Design Patterns & Anti-Patterns
Choosing the right load balancer type and configuration is itself a design decision, and getting it wrong is a surprisingly common mistake.
Situation
A team building a high-frequency trading application, where every millisecond of latency matters and the client’s real IP address must be preserved, defaults to an Application Load Balancer because it’s the load balancer type they’ve heard of most often.
Why It Fails
An Application Load Balancer operates at the application layer and performs additional processing to inspect HTTP content, adding latency the trading application cannot tolerate, and it does not preserve the original client IP the same way a Network Load Balancer does.
Better Approach
Match the load balancer type to the requirement: a Network Load Balancer for extreme performance and IP preservation, an Application Load Balancer for content-aware web routing, and a Gateway Load Balancer for transparently inserting security appliances into the traffic path.
Good Patterns to Follow
- Use path-based or host-based routing to consolidate load balancers instead of creating a new one per microservice.
- Enable deregistration delay (connection draining) so in-flight requests finish cleanly during scale-in or deployments.
- Spread targets evenly across at least two Availability Zones so the load balancer can actually route around a zone failure.
12Best Practices & Common Mistakes
Most ELB problems in the real world trace back to a handful of avoidable configuration mistakes.
Best Practices
- Choose the load balancer type based on protocol and performance needs, not familiarity
- Configure health checks to match a real, meaningful endpoint in your application
- Enable access logging to Amazon S3 for troubleshooting and auditing
- Set CloudWatch alarms on unhealthy host count and 5xx error rates
- Terminate SSL/TLS at the load balancer to simplify certificate management
Common Mistakes
- Pointing health checks at an endpoint that doesn’t reflect true application health
- Overusing sticky sessions, causing uneven load across servers
- Registering targets in only one Availability Zone, defeating the purpose of redundancy
- Allowing backend servers to accept traffic directly from the internet, bypassing the load balancer’s protections
13Real-World & Industry Examples
Seeing how real organizations actually use ELB makes the abstract concepts click into place.
Flash Sale Traffic Handling
Retailers pair an Application Load Balancer with Auto Scaling to absorb sudden massive spikes during limited-time sales events.
High-Throughput Video Delivery
Streaming platforms use Network Load Balancers to handle extremely high volumes of connections with minimal added latency.
Secure Internal Routing
Banks use internal, private load balancers to route traffic between microservices without ever exposing them to the public internet.
Traffic Inspection Pipelines
Organizations use Gateway Load Balancers to transparently route all traffic through third-party firewalls before it reaches applications.
Across every one of these industries, the common thread is the same: the load balancer is invisible when everything works, and indispensable the moment something doesn’t — a single server crashing, a data center losing power, or traffic spiking tenfold overnight all become non-events instead of outages.
14Frequently Asked Questions
An Application Load Balancer works at the HTTP/HTTPS layer and can route based on URL paths or hostnames, making it ideal for web applications. A Network Load Balancer works at the TCP/UDP layer, prioritizing extreme performance and preserving the client’s original IP address, making it ideal for latency-sensitive or high-throughput workloads.
Amazon designs Elastic Load Balancing to be highly available by running redundant nodes across multiple Availability Zones and automatically scaling its own capacity, so it’s built specifically to avoid becoming a single point of failure for your application.
The load balancer stops sending new traffic to that target after it fails a configured number of consecutive health checks, and automatically resumes sending traffic once the target starts passing health checks again, all without manual intervention.
Yes, particularly with an Application Load Balancer, which supports path-based and host-based routing rules, letting one load balancer serve many different backend applications or microservices based on the incoming request’s URL or hostname.
No. Amazon Route 53 is a DNS service that translates domain names into IP addresses and can route traffic across regions, while Elastic Load Balancing distributes traffic across servers within one or more Availability Zones once that traffic has already arrived — the two are often used together, with Route 53 pointing to a load balancer.
15Summary & Key Takeaways
Key Takeaways
- Elastic Load Balancing is a fully managed service that automatically distributes incoming traffic across multiple servers or targets.
- Four types exist for four different needs: Application Load Balancer for content-aware web routing, Network Load Balancer for extreme performance, Gateway Load Balancer for security appliances, and Classic Load Balancer for legacy applications.
- Health checks continuously verify target health, automatically removing and restoring servers from rotation without human intervention.
- The load balancer itself scales automatically, avoiding becoming the very bottleneck it’s meant to prevent.
- Spreading targets across Availability Zones is what allows an application to survive an entire data center outage.
- Security is layered — security groups, SSL termination, AWS WAF integration, and private internal load balancers all work together.
- Real companies across e-commerce, streaming, finance, and security rely on ELB to keep applications responsive no matter how traffic spikes or servers fail.