Question

Difficulty: MediumAuto Scaling and Elastic Load Balancing (ELB)

A company is deploying a containerized microservice for processing real-time IoT telemetry data. The service runs on Amazon EC2 instances managed by an Auto Scaling group (ASG). An Application Load Balancer (ALB) routes traffic to the instances. The telemetry service is configured to listen on port 8080. The target group is configured to route traffic to port 8080. The security group associated with the EC2 instances allows inbound traffic on port 8080 from the ALB security group. After deployment, the ALB registers all EC2 instances as unhealthy, and users receive a 502 Bad Gateway error. The solutions architect verifies that the service is running and healthy on the instances when tested locally on port 8080. Which action should the solutions architect take to resolve this issue?

  1. A
    Add a rule to the subnet Network Access Control List (NACL) allowing inbound traffic on port 80 and ephemeral ports from the client subnet.
  2. Update the target group health check settings to query port 8080 instead of the default port 80.Answer
  3. C
    Configure the EC2 security group to permit inbound TCP traffic on port 80 from the Application Load Balancer security group.
  4. D
    Change the Amazon Route 53 routing policy to latency-based routing with target health checks pointing directly to the EC2 instances.

Answer

Update the target group health check settings to query port 8080 instead of the default port 80.
The correct answer is to update the target group health check settings to query port 8080. By default, unless specified, the health check port may default to port 80. Since the microservice is listening on port 8080, the load balancer's health check requests to port 80 fail, causing the instances to be marked as unhealthy. Explicitly setting the health check port to 8080 resolves the issue.

Step-by-Step Solution

1
Identify the port on which the service is listening on the EC2 instances.
The application listens and runs healthy on port 8080.
This establishes the target port that health checks and routing should target.
2
Check the default target group health check port settings.
By default, health check configurations often default to port 80 rather than the traffic port if not explicitly overridden.
This identifies the source of the health check failure (requesting port 80 instead of 8080).
3
Modify the health check port to 8080.
The load balancer begins successfully checking the application on port 8080 and marks instances as healthy.
Aligning the health check port with the active application port resolves the unhealthy status and the 502 Bad Gateway errors.

Key Concept

ELB Target Group Health Check Port Alignment
Rate this question