Interview Prep/AWS/EC2, Auto Scaling and Load Balancing

Why would an ALB target show as unhealthy?

BeginnerConceptEC2, Auto Scaling and Load Balancing
Answer

The usual causes: the health check path returns a non-matching status (default success is 200), the target security group does not allow the ALB's SG on the health check port, the app is not listening on that port, the check times out (default 5 s timeout, 30 s interval, 5 healthy / 2 unhealthy thresholds), or the app redirects to HTTPS and returns 301.

aws elbv2 describe-target-health --target-group-arn $TG_ARN \
  --query 'TargetHealthDescriptions[].[Target.Id,TargetHealth.State,TargetHealth.Reason]'

The Reason field (Target.Timeout, Target.ResponseCodeMismatch) points directly at the cause.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing