A company hosts a microservice on Amazon EC2 instances managed by an Auto Scaling group (ASG) behind an Application Load Balancer (ALB). The EC2 instances are located in private subnets, and the ALB is in public subnets. The application on the EC2 instances listens on TCP port 8080. A custom Network ACL (NACL) is applied to the private subnets. The solutions architect notices that the ALB target group marks all EC2 instances as unhealthy, and clients receive HTTP 502 Bad Gateway errors. The security groups for both the ALB and the EC2 instances are configured to allow traffic on port 8080. Which configuration change is required to resolve this issue and restore healthy status to the target group?
- AAdd an outbound rule to the EC2 instances' security group allowing TCP traffic on ephemeral ports to the ALB, because security group rules are stateless.
- BReconfigure the target group health check port to TCP port 80, as the ALB listener is configured to receive HTTP traffic on port 80.
- Add an outbound rule to the private subnet Network ACL that allows TCP traffic on ephemeral ports (1024-65535) to the public subnets.Answer
- DModify the Amazon Route 53 routing policy to use Latency Routing with health checks enabled to automatically route the ALB health check probes to healthy instances.
Answer
Add an outbound rule to the private subnet Network ACL that allows TCP traffic on ephemeral ports (1024-65535) to the public subnets.
The correct option is to add an outbound rule to the private subnet Network ACL that allows TCP traffic on ephemeral ports (1024-65535) to the public subnets. Because Network ACLs are stateless, return traffic from the EC2 instances back to the ALB must be explicitly allowed. When the ALB sends a health check request to port 8080 on the instances, the return traffic from port 8080 goes back to the ALB's ephemeral ports.
Step-by-Step Solution
Key Concept
Understanding the stateless nature of Network ACLs compared to stateful Security Groups when configuring health checks between an ALB and backend targets.