Soru

Zorluk: ZorAuto Scaling and Elastic Load Balancing (ELB)

A company runs a high-availability customer portal on Amazon EC2 instances managed by an Auto Scaling Group (ASG) behind an Application Load Balancer (ALB). The ALB target group is configured with ELB health checks targeting a deep health check endpoint (`/healthcheck`) that queries the backend Amazon RDS database. During a scheduled database maintenance window, the database becomes temporarily unresponsive. Consequently, all EC2 instances fail the target group health check. Since the ASG health check type is set to ELB, it begins terminating and recreating all instances in a continuous loop, causing prolonged downtime and high operational costs. Which architectural modification should a Solutions Architect implement to prevent this loop of instance terminations during database outages?

  1. A
    Change the target group health check port to port 80 while keeping the application listening on its custom port, to isolate the health checks from the application port.
  2. B
    Update the subnet Network ACLs to stateless inbound rules that allow database traffic, omitting the corresponding outbound rules under the assumption that Network ACLs are stateful.
  3. Configure the ALB health check to query a shallow endpoint that only verifies the web server status, and handle database connectivity issues gracefully within the application code.Cevap
  4. D
    Configure an Amazon Route 53 Latency routing policy to automatically route client requests to a backup static page, without configuring Route 53 health checks.

Cevap

Configure the ALB health check to query a shallow endpoint that only verifies the web server status, and handle database connectivity issues gracefully within the application code.
The correct answer is to configure a shallow health check. A shallow health check only verifies that the web server or application process is running (e.g., via a simple static file or status page), rather than verifying deep dependencies like database connectivity. When the database becomes unavailable, the web server instances will still pass the shallow health check, preventing the Auto Scaling Group from terminating them. The application can then handle the database outage gracefully by displaying a maintenance page or returning a structured error code, while keeping the infrastructure stable.

Adım Adım Çözüm

1
Identify the root cause of the instance termination loop.
The deep health check queries the database, causing the ALB to mark instances as unhealthy when the database is down, which prompts the ASG to terminate healthy web server instances.
Understanding the dependency between target group health checks and ASG instance lifecycle is critical to troubleshooting termination loops.
2
Modify the target group health check configuration to use a shallow endpoint.
The health check path is changed to target a static page or a lightweight endpoint (e.g., `/ping` or `/index.html`) that only verifies the web server process itself is running.
A shallow health check ensures the load balancer only monitors the health of the EC2 instance and the web server process, preventing database outages from triggering instance termination.
3
Implement application-level error handling for database connection failures.
The application handles database connection errors gracefully (e.g., by displaying a friendly error message or a read-only view) without failing the ALB health check.
Graceful degradation ensures the application remains online to serve static content or error messages rather than experiencing a complete infrastructure tear-down.

Anahtar Kavram

Shallow vs. Deep Health Checks in Elastic Load Balancing and Auto Scaling Groups
Bu soruyu puanla