Interview Prep/Networking/Load balancers and reverse proxies

An NLB shows all targets healthy, but clients from the internet time out connecting through it.

IntermediateTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → With instance targets (or IP targets with client IP preservation on), the NLB passes the client's IP through. Health checks come from the NLB's private IPs (allowed), but the target's security group doesn't allow the client CIDRs, so real traffic is dropped.

Diagnose →

aws elbv2 describe-target-group-attributes --target-group-arn <tg> \
  --query "Attributes[?Key=='preserve_client_ip.enabled']"
aws ec2 describe-security-groups --group-ids <target-sg> --query 'SecurityGroups[0].IpPermissions'
# VPC Flow Logs on the target ENI will show REJECT for client IPs

Fix → Allow the client CIDRs (or 0.0.0.0/0 for public services) on the target SG for the listener port, or attach a security group to the NLB and reference it from the target SG.

Prevent → Use NLB security groups (supported since 2023) and template SG rules together with the listener.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies