Q23 — AWS SAA-C03 Ch.6
Question 23 of 65 | ← Chapter 6
Q388. A company deploys an application on five Amazon EC2 instances. An Application Load Balancer (ALB) distributes traffic to the instances by using a target group. The average CPU usage on each of the instances is below 10% most of the time. with occasional surges to 65%. A solutions architect needs to implement a solution to automate the scalability of the application. The solution must optimize the cost of the architecture and must ensure that the application has enough CPU resources when surges occur.Which solution will meet these requirements?
- A. Create an Amazon CloudWatch alarm that enters the ALARM state when the CPUUtilization metric is less than 20%. Create an AWS Lambda function that the CloudWatch alarm invokes to terminate one of the EC2 instances in the ALB target group
- B. Create an EC2 Auto Scaling group. Select the existing ALB as the load balancer and the existing target group as the target group. Set a target tracking scaling policy that is based on the ASGAverageCPUUtilization metric. Set the minimum instances to 2, the desired capacity to 3, the maximum instances to 6, and the target value to 50%. Add the EC2 instances to the Auto Scaling group ✓
- C. Create an EC2 Auto Scaling group. Select the existing ALB as the load balancer and the existing target group as the target group. Set the minimum instances to 2, the desired capacity to 3, and the maximum instances to 6. Add the EC2 instances to the Auto Scaling group
- D. Create two Amazon CloudWatch alarms. Configure the first CloudWatch alarm to enter the ALARM state when the average CPUUtilization metric is below 20%. Configure the second CloudWatch alarm to enter the ALARM state when the average CPUUtilization metric is above 50%. Configure the alarms to publish to an Amazon Simple Notification Service (Amazon SNS) topic to send an email message After receiving the message. log in to decrease or increase the number of EC2 instances that are running
Correct Answer: B. Create an EC2 Auto Scaling group. Select the existing ALB as the load balancer and the existing target group as the target group. Set a target tracking scaling policy that is based on the ASGAverageCPUUtilization metric. Set the minimum instances to 2, the desired capacity to 3, the maximum instances to 6, and the target value to 50%. Add the EC2 instances to the Auto Scaling group
Explanation
Creating an EC2 Auto Scaling group allows you to automatically adjust the number of instances based on demand, ensuring scalability.By selecting the existing ALB as the load balancer and target group, the traffic distribution remains unchanged.Setting a target tracking scaling policy based on the ASGAverageCPUUtilization metric ensures that the CPU utilization stays within the desired range (50% in this case). Configuring the minimum instances to 2 and the maximum instances to 6 provides flexibility for scaling up or down based on demand.Adding the EC2 instances to the Auto Scaling group ensures they are managed by the scaling policies. Option A is not the best choice because terminating an EC2 instance based on a CloudWatch alarm when the CPU utilization is below 20% may not be optimal for handling surges. It could result in insufficient capacity during peak times.Option C is similar to option B but lacks the target tracking scaling policy, which is essential for automatically adjusting the number of instances based on CPU utilization. Option D suggests using CloudWatch alarms to trigger manual actions to increase or decrease the number of EC2 instances. This approach is not automated and does not optimize cost or ensure timely scaling.