Question #1316
A company hosts a web application on four Amazon EC2 instances fronted by an Application Load Balancer (ALB) using a target group. The average CPU utilization across the instances hovers around 20%, with intermittent spikes up to 60%. A solutions architect must design an auto-scaling solution that minimizes costs while ensuring adequate CPU resources during traffic spikes. Which solution fulfills these requirements?
Create a CloudWatch alarm that triggers when CPUUtilization drops below 25%. Configure an AWS Lambda function invoked by the alarm to terminate an EC2 instance in the target group.
Create an EC2 Auto Scaling group linked to the existing ALB and target group. Configure a target tracking scaling policy using the ASGAverageCPUUtilization metric. Set the minimum instances to 2, desired capacity to 4, maximum instances to 7, and target value to 40%. Add the existing EC2 instances to the Auto Scaling group.
Create an EC2 Auto Scaling group associated with the existing ALB and target group. Set the minimum instances to 2, desired capacity to 4, and maximum instances to 7. Do not configure a scaling policy. Add the EC2 instances to the Auto Scaling group.
Create two CloudWatch alarms: one triggering when average CPUUtilization is below 25% and another when it exceeds 60%. Configure both alarms to publish to an SNS topic for email notifications. Manually adjust the number of EC2 instances after receiving alerts.
Explanation
The correct answer is B because:
1. Target Tracking Scaling Policy: Automatically adjusts instance count to maintain a 40% CPU target, balancing cost and performance. The 40% target is below the spike threshold (60%), allowing proactive scaling before CPU peaks.
2. Min/Max/Desired Settings: Minimum 2 instances prevent under-provisioning, maximum 7 limits costs, and desired 4 aligns with current usage.
3. Integration with ALB: Links to the existing ALB/target group, ensuring traffic distribution.
4. Cost Optimization: Scales in during low usage (e.g., below 40%) and scales out during spikes, avoiding over-provisioning.
Why others are incorrect:
- A: Only scales down (no scale-up), risks under-provisioning during spikes.
- C: No scaling policy; instances remain static despite load changes.
- D: Manual scaling is slow and error-prone, failing to handle sudden spikes.
Key Points:
- Use target tracking for automated, metric-based scaling.
- Set target values between average and peak thresholds for proactive scaling.
- Configure min/max to balance cost and availability.
Answer
The correct answer is: B