What is a Load Balancer in AWS?
Learn what a load balancer is in AWS, how ALB and NLB differ, how health checks and Auto Scaling integrate, and how to explain ELB in an interview.
Expected Interview Answer
A load balancer in AWS is a managed service (Elastic Load Balancing) that automatically distributes incoming traffic across multiple targets — such as EC2 instances, containers, or IP addresses — to improve availability, fault tolerance, and scalability.
ELB continuously health-checks registered targets and only routes traffic to healthy ones, automatically removing failed targets from rotation so a single instance failure doesn't cause an outage. AWS offers several load balancer types: the Application Load Balancer (ALB) operates at Layer 7, routing based on HTTP path, host, or headers, ideal for web applications and microservices; the Network Load Balancer (NLB) operates at Layer 4, handling extreme throughput and static IPs for TCP/UDP traffic; and the Gateway Load Balancer routes traffic through third-party virtual appliances. Load balancers integrate with Auto Scaling to add or remove targets as demand changes, and they can terminate TLS, freeing backend instances from certificate management.
- Distributes traffic to prevent any single instance from being overwhelmed
- Automatically removes unhealthy targets from rotation
- Integrates with Auto Scaling for elastic capacity
- Enables zero-downtime deployments via rolling target registration
- Offloads TLS termination from backend instances
AI Mentor Explanation
A load balancer is like a team manager assigning incoming net-session requests to whichever bowler is currently free and fit, rather than piling every request onto one exhausted bowler. If a bowler pulls up injured, the manager stops sending them batters immediately, and as more nets open up during a busy camp, the manager spreads work across all of them automatically.
Step-by-Step Explanation
Step 1
Register targets
EC2 instances, containers, or IPs are registered with a target group behind the load balancer.
Step 2
Configure health checks
The load balancer periodically pings targets and marks them healthy or unhealthy.
Step 3
Route incoming requests
Traffic is distributed only to healthy targets using the chosen algorithm and listener rules.
Step 4
Terminate TLS if configured
The load balancer can decrypt HTTPS traffic, offloading certificate management from backend targets.
Step 5
Integrate with Auto Scaling
As Auto Scaling adds or removes instances, the load balancer automatically updates its target pool.
What Interviewer Expects
- Explains ELB as traffic distribution across multiple healthy targets
- Distinguishes ALB (Layer 7, HTTP-aware) from NLB (Layer 4, high throughput)
- Mentions health checks and automatic removal of unhealthy targets
- Understands integration with Auto Scaling groups
- Knows load balancers can terminate TLS
Common Mistakes
- Treating all AWS load balancers as functionally identical (ALB vs NLB vs GLB differ)
- Forgetting health checks are what enable automatic failover
- Assuming a load balancer scales the application itself rather than routing to whatever Auto Scaling provides
- Confusing Layer 7 (ALB) routing rules with Layer 4 (NLB) connection-based routing
Best Answer (HR Friendly)
“A load balancer spreads incoming website or app traffic across several servers instead of overwhelming just one, and automatically stops sending traffic to any server that stops working. This keeps applications fast and available even during traffic spikes or server failures.”
Code Example
aws elbv2 create-load-balancer \
--name skillveris-alb \
--subnets subnet-0abc1234 subnet-0def5678 \
--security-groups sg-0123456789abcdef0
aws elbv2 create-target-group \
--name skillveris-tg \
--protocol HTTP --port 80 --vpc-id vpc-0123456789abcdef0 \
--health-check-path /health
# Output (truncated): TargetGroupArn, HealthCheckIntervalSeconds: 30Follow-up Questions
- What is the difference between an Application Load Balancer and a Network Load Balancer?
- How does a load balancer perform health checks?
- How does ELB integrate with Auto Scaling groups?
- What is TLS termination and why offload it to the load balancer?
- What routing algorithms does an ALB support?
MCQ Practice
1. Which AWS load balancer type operates at Layer 7 and can route based on HTTP path or host headers?
The Application Load Balancer (ALB) works at Layer 7, enabling content-based routing using HTTP paths, hosts, or headers.
2. What happens when a target fails a load balancer's health check?
Unhealthy targets are automatically removed from the routing rotation until they pass health checks again.
3. Which load balancer type is best suited for extremely high-throughput TCP/UDP traffic with static IPs?
The Network Load Balancer (NLB) operates at Layer 4 and is designed for extreme performance and static IP support.
Flash Cards
What does a load balancer do in AWS? — Distributes incoming traffic across multiple healthy targets to improve availability and scalability.
ALB vs NLB? — ALB operates at Layer 7 for HTTP-aware routing; NLB operates at Layer 4 for high-throughput TCP/UDP.
How does ELB detect a failed target? — Through periodic health checks; failed targets are automatically removed from routing.
What does TLS termination at the load balancer do? — Decrypts HTTPS traffic at the load balancer, offloading certificate management from backend instances.