← Back to Playbooks
    SEV-2AWS

    ELB/ALB Health Check Failures Playbook

    Targets draining, 502/504 gateway errors, misconfigured health checks, and target group registration issues. Load balancer health check failures cause traffic blackholes and cascading service degradation.

    Operator's Field Notes

    Jeremy Martinez · Incident Commander | Principal Site Reliability Engineer

    "ALB health check failures are tricky because the symptoms differ based on whether ALL targets are unhealthy or just some. If all targets are unhealthy, the ALB returns 503. If some are unhealthy, traffic concentrates on healthy ones - which can then overload and fail too. That's the cascading failure scenario."

    "The most common root cause I see: the health check path returns 200 when hit directly but the ALB can't reach it because of security group rules. The ALB's security group needs to allow outbound to the target's port, and the target's security group needs to allow inbound from the ALB's security group. Miss either direction and health checks fail silently."

    First 5 Minutes - Triage

    1. Check Target Health

    # List target health for all targets in the group
    aws elbv2 describe-target-health --target-group-arn arn:aws:elasticloadbalancing:...
    
    # Output shows:
    #   "healthy" - passing health checks
    #   "unhealthy" - failing health checks (check Reason field)
    #   "draining" - being deregistered
    #   "initial" - registering, not yet checked
    #   "unused" - target group not used by any listener
    
    # Common Reason values:
    #   "Target.ResponseCodeMismatch" - app returns non-200
    #   "Target.Timeout" - health check request timed out
    #   "Target.FailedHealthChecks" - consecutive failures exceeded threshold
    #   "Elb.InternalError" - ALB-side issue

    2. Check Health Check Configuration

    # Review health check settings
    aws elbv2 describe-target-groups --target-group-arns arn:aws:elasticloadbalancing:...
    
    # Key settings to verify:
    #   HealthCheckPath: /health (or whatever your app uses)
    #   HealthCheckPort: traffic-port (or specific port)
    #   HealthCheckProtocol: HTTP or HTTPS
    #   HealthyThresholdCount: 2-5
    #   UnhealthyThresholdCount: 2-3
    #   HealthCheckTimeoutSeconds: 5-30
    #   HealthCheckIntervalSeconds: 10-300
    #   Matcher: {"HttpCode": "200"} (or "200-299")

    3. Test Health Check from Target

    # SSH/SSM to a target instance and test locally
    curl -v http://localhost:8080/health
    
    # Test from another instance in the same VPC
    curl -v http://PRIVATE_IP:8080/health
    
    # Check if the app is even listening on the expected port
    ss -tlnp | grep 8080
    # or
    netstat -tlnp | grep 8080
    
    # Check security groups
    aws ec2 describe-security-groups --group-ids sg-ALB sg-TARGET

    Common Failure Modes

    502 Bad Gateway

    ALB received an invalid response from the target

    • • Target closed connection before responding
    • • Target returned malformed HTTP response
    • • SSL/TLS handshake failure (HTTPS target)
    • → Check ALB access logs for elb_status_code vs target_status_code

    504 Gateway Timeout

    Target didn't respond within the idle timeout

    • • Application processing too slowly
    • • Target's keep-alive shorter than ALB idle timeout
    • • Database queries blocking the health check endpoint
    • → Set target keep-alive > ALB idle timeout (default 60s)

    503 Service Unavailable

    No healthy targets available

    • • All targets failing health checks
    • • Target group has no registered targets
    • • All targets are in "draining" state
    • → Check if deployment deregistered all targets simultaneously

    Prevention

    Health Check Best Practices

    • • Dedicated /health endpoint (fast, no DB)
    • • Separate deep health check for readiness
    • • Health check timeout < interval
    • • Use 200-299 matcher range
    • • Deregistration delay matches drain time

    Deployment Safety

    • • Rolling deployments (never drain all targets)
    • • Pre-deployment health check validation
    • • Connection draining timeout > in-flight request time
    • • Min healthy percentage in deployment config
    • • ALB access log analysis for error patterns