BeCuriouzLearn something new every day
The AWS traffic cop that keeps your app alive when a server dies
💡 A load balancer spreads incoming traffic across multiple servers and uses health checks to route around failed ones, keeping your app available even when a server dies.
Imagine your app runs on three identical servers. What decides which one handles each incoming visitor — and what happens when one server crashes at 2 a.m.? That's the job of the Elastic Load Balancer (ELB), a managed AWS service that sits in front of your servers and spreads incoming requests across them.
The magic ingredient is the health check. The load balancer repeatedly pings each server on a path you choose (say /health). If a server stops responding, ELB quietly stops sending it traffic and reroutes to the healthy ones — no user ever sees the error. When the server recovers, it's added back automatically.
ELB also pairs naturally with auto scaling: as scaling adds or removes servers to match demand, the load balancer instantly starts or stops routing to them. Together they give you an app that's both highly available (survives a failure) and elastic (grows and shrinks with traffic) — without you manually editing any server lists.