In short
Once you have more than one server, someone has to decide which one gets each request, and stop sending people to the one that just crashed. That someone is the load balancer.
Applying Phase 2's load balancer concepts specifically to distributing traffic across a fleet of compute instances — health checks, target groups, and routing rules all connect the load balancer to your compute layer.

Think of it like this
The cop at the toll plaza
At a busy toll plaza, a traffic cop waves cars to whichever booth is free. If one booth's barrier is stuck, he stops sending cars there until it's fixed. A load balancer does that for requests.
Watch it happen
Health checks in action
GET /products
1/6A request reaches the load balancer's single public address.
The big ideas
What you need to know
Target groups
The load balancer forwards to a group of targets: instances, IPs or containers. Auto scaling adds and removes them.
Health checks
A small /health endpoint that returns 200 when the app is truly ready. Unhealthy targets get no traffic.
Layer 7 routing
An application load balancer can send /api to one group and /images to another, based on path or host.
TLS at the edge
The load balancer can hold the HTTPS certificate, so your servers deal with plain HTTP inside the VPC.
See it in code
Walk through the code
1resource "aws_lb_target_group" "web" {2 name = "web-tg"3 port = 80804 protocol = "HTTP"5 vpc_id = aws_vpc.main.id6 7 health_check {8 path = "/health"9 matcher = "200"10 interval = 1511 healthy_threshold = 212 unhealthy_threshold = 313 }14}1/3Targets listen on port 8080 inside the VPC.
Terraform for a target group. Attach it to an application load balancer listener and an auto scaling group.
Save yourself the pain
Common mistakes
Oops
Pointing the health check at the home page that loads ten database queries.
Do this instead
Use a light /health route that checks the app is up and its key dependencies are reachable.
Oops
Opening app servers to the internet as well as the load balancer.
Do this instead
Let app servers accept traffic only from the load balancer's security group.
Your mission
Break one server on purpose
Quick check
A target fails its health checks. What does the load balancer do?
Go deeper
- 1Attach a load balancer to a set of VM instances or an auto scaling group.
- 2Configure a health check and verify unhealthy instances stop receiving traffic.
- 3Learn to test failover by manually stopping one instance and observing traffic reroute.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.