Question #1030
A company hosts a web application on a single Amazon EC2 instance. Users report increased latency during peak traffic periods, with CPU utilization consistently exceeding 90%. A user data script installs specialized software packages during instance launch, which delays the process by several minutes. The company is configuring an Auto Scaling group with mixed instance types, diverse memory configurations, and a fixed maximum capacity. The Auto Scaling group uses a launch template for instance configuration. The company needs to minimize application latency when new instances are provisioned during scaling events. Which solution addresses these requirements?
Use a predictive scaling policy. Configure an instance refresh to execute the user data script. Set the health check grace period to 0 seconds.
Use a target tracking scaling policy. Use lifecycle hooks to execute the user data script. Set the health check grace period to 0 seconds.
Use a predictive scaling policy. Enable warm pools for the Auto Scaling group. Configure an instance refresh to execute the user data script.
Use a target tracking scaling policy. Enable warm pools for the Auto Scaling group. Use lifecycle hooks to execute the user data script.
Explanation
Answer D is correct because:
1. Target Tracking Scaling Policy: Adjusts capacity based on CPU utilization, directly addressing the high CPU issue during peak traffic.
2. Warm Pools: Maintain pre-initialized instances in a stopped state. When scaling, these instances start faster since the user data script (with time-consuming installations) has already executed during initial launch, reducing provisioning delays.
3. Lifecycle Hooks: Allow the Auto Scaling group to pause instance transitions (e.g., from 'Pending' to 'InService') to ensure the user data script completes before the instance serves traffic, avoiding premature health checks.
Why other options are incorrect:
- A/C: Instance refresh updates existing instances but doesn’t address scaling delays. Predictive scaling forecasts demand but doesn’t resolve the user data script delay.
- B: Setting the health check grace period to 0 risks marking instances unhealthy before the user data script finishes, causing flapping. Lifecycle hooks alone don’t pre-initialize instances.
Key Points:
- Warm pools reduce scaling latency by pre-configuring instances.
- Lifecycle hooks ensure critical setup completes before traffic routing.
- Target tracking aligns scaling with real-time metrics like CPU.
Answer
The correct answer is: D