A company hosts a web service on Amazon EC2 instances in private subnets. The instances are managed by an Auto Scaling group (ASG) behind an Application Load Balancer (ALB). The web service is configured to listen on TCP port . The ALB target group has its target port set to , and the EC2 instances' security group allows inbound traffic on port from the ALB's security group. After a recent deployment, the ALB marks all instances in the target group as unhealthy, and clients receive HTTP (Bad Gateway) errors, even though the application logs confirm that the service is running and healthy on the instances. What is the most likely cause of this issue?
- AThe Network ACL of the private subnet lacks an inbound rule that allows traffic from the security group of the Application Load Balancer.
- BThe security group associated with the EC2 instances is stateless, requiring an explicit outbound rule to allow return traffic back to the Application Load Balancer.
- The target group is configured to perform health checks using the default port (HTTP port ) rather than port where the application is listening.Answer
- DAmazon Route latency routing is misconfigured to route traffic directly to the private IP addresses of the EC2 instances, bypassing the Application Load Balancer.
Answer
The target group is configured to perform health checks using the default port (HTTP port ) rather than port where the application is listening.
The Application Load Balancer determines target health using the configured health check port. If this is left as the default (typically port ) rather than the application's actual listening port (), the health check probes will fail, leading the load balancer to mark all instances as unhealthy and return HTTP Bad Gateway errors.
Step-by-Step Solution
Key Concept
Target Group Health Checks