Interview Prep/Networking/Cloud networking: VPC, firewalls, NAT, VPN and proxies

ALB targets are `unhealthy` with reason `Target.Timeout`, and VPC Flow Logs show `REJECT` from the ALB's IPs to the instances.

BeginnerTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer

Likely causes → The instance SG doesn't allow traffic from the ALB on the target/health check port. Often the SG allows only 0.0.0.0/0:443 while the app listens on 8080, or it references the wrong SG.

Diagnose →

aws elbv2 describe-load-balancers --names <alb> --query 'LoadBalancers[0].SecurityGroups'
aws ec2 describe-security-groups --group-ids <instance-sg> --query 'SecurityGroups[0].IpPermissions'

Fix → Allow the target port (and health check port if different) from the ALB's security group:

aws ec2 authorize-security-group-ingress --group-id <instance-sg> \
  --protocol tcp --port 8080 --source-group <alb-sg>

Prevent → Always reference the LB SG rather than CIDRs; manage both in one module.

All Networking questions Roadmap: Networking for DevOps

More on Cloud networking: VPC, firewalls, NAT, VPN and proxies