My ALB Health Checks Were Failing
My ALB Health Checks Were Failing (And It Wasn't What I Thought)
I stood up an Application Load Balancer in front of three EC2 instances, registered them as targets, and the dashboard showed all targets unhealthy. Traffic wasn't routing.
I checked the obvious stuff first:
- Security groups allowed port 80 ✓
- Instances were running ✓
- App was listening on port 80 ✓
Still unhealthy. Here's what I missed:
The Problem
The ALB health check was hitting the root path (
/) by default, but my app only served content at /health. The root returned a 404, and the ALB interpreted that as "target is down."The Fix
Target Group → Edit health check → change the path from
/ to /health:1
2
3
4
Path: /health
Port: traffic-port
Protocol: HTTP
Success codes: 200Saved. Within 30 seconds, all three targets flipped to healthy.
What I'd Tell Someone Hitting the Same Wall
The ALB doesn't care what your app should return at
/ it only cares what it actually returns. A 404, 500, or even a 401 all mean "unhealthy" unless you explicitly tell the health check which status codes count as success.One takeaway: When ALB health checks fail but your instances look fine, curl the health check path from outside the VPC. You'll see exactly what the ALB is seeing.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article