Question

Difficulty: MediumAuto Scaling and Elastic Load Balancing (ELB)

A financial services company hosts a report generation API on Amazon EC2 instances. The instances are managed by an Auto Scaling group (ASG) behind an Application Load Balancer (ALB). The report generation requests are computationally intensive and can take up to 180180 seconds to complete. To allow fast instance replacement during application deployments, a developer set the ALB target group's deregistration delay to 3030 seconds. However, during scale-in events, users report receiving HTTP 502 (Bad Gateway) errors for reports that were in progress.

Which modification should a solutions architect recommend to resolve these errors?

  1. A
    Add a rule to the private subnet's Network ACL to allow inbound traffic on ephemeral ports (10241024-6553565535) from the ALB, and reduce the ASG cooldown period to 3030 seconds.
  2. Increase the deregistration delay of the ALB target group to at least 180180 seconds.Answer
  3. C
    Configure the ALB target group health check to use a dedicated management port instead of the traffic port, and reduce the health check interval.
  4. D
    Implement an Amazon Route 53 latency-based routing policy to redirect active user sessions to a secondary region during scale-in events.

Answer

Increase the deregistration delay of the ALB target group to at least 180180 seconds.
Increasing the deregistration delay (also known as connection draining) of the target group to match or exceed the maximum request processing time (180180 seconds) ensures that the Application Load Balancer allows in-flight requests to complete before the Auto Scaling group terminates the instance.

Step-by-Step Solution

1
Analyze the cause of the HTTP 502 errors during scale-in events.
The errors occur because the target group's deregistration delay of 3030 seconds is shorter than the maximum request completion time of 180180 seconds, leading to premature connection termination.
Understanding the connection lifecycle is key to resolving premature terminations.
2
Determine the necessary configuration adjustment for the load balancer.
The deregistration delay must be increased to a value equal to or greater than 180180 seconds.
This configuration tells the load balancer to wait for active requests to finish before the instances are fully terminated.
3
Verify if other configuration elements like Network ACLs, health checks, or DNS routing can resolve this.
None of the other options address connection draining; they either misapply network access controls, load balancer health checks, or DNS routing policies.
Deregistration delay is the specific ELB feature designed to manage connection lifecycle during scaling.

Key Concept

Deregistration delay (connection draining) ensures that a load balancer stops routing new requests to targets that are deregistering, but allows existing in-flight connections to complete before the target is fully terminated.
Rate this question