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

Target health shows `Target.Timeout: Request timed out` for every target.

IntermediateTroubleshootingEC2, Auto Scaling and Load Balancing
Answer

Likely causes → The ALB cannot reach the targets. The usual reasons: the target SG does not allow the health check port from the ALB SG, a NACL blocks it, the app listens only on 127.0.0.1, or the health check uses the wrong port.

Diagnose →

aws elbv2 describe-target-health --target-group-arn <tg-arn>
aws ec2 describe-security-groups --group-ids <target-sg> --query 'SecurityGroups[].IpPermissions'
# on the target:
sudo ss -lntp | grep 8080      # 127.0.0.1:8080 means not reachable from the ALB

Fix →

  1. Allow the app port from the ALB SG: aws ec2 authorize-security-group-ingress --group-id <target-sg> --protocol tcp --port 8080 --source-group <alb-sg>
  2. Bind the app to 0.0.0.0
  3. Check that the NACL allows the ephemeral return ports

Prevent → Use SG-to-SG references in IaC rather than CIDRs, and run Reachability Analyzer from the ALB ENI to the target.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing