SOA-C02 Question 20
Single answerYour company hosts a critical web application on an EC2 instance in a production environment. You are tasked with ensuring that the instance is restarted automatically if the CPU utilization remains below 10% for 15 consecutive minutes, as this may indicate a system issue. How can you achieve this using Amazon CloudWatch?
- A
Create a CloudWatch alarm that monitors the CPUUtilization metric and triggers an Auto Scaling policy to restart the instance.
- B
Create a CloudWatch alarm that monitors the CPUUtilization metric and configures an EC2 action to reboot the instance when the alarm is triggered.
- C
Create a CloudWatch alarm that monitors the StatusCheckFailed_System metric and configures an EC2 action to restart the instance when the alarm is triggered.
- D
Configure an EventBridge rule to monitor CPUUtilization and restart the instance when utilization drops below 10% for 15 minutes.
Show answer and explanation
Correct answer: B
Explanation
To automatically restart an EC2 instance based on CPU utilization, you can use a CloudWatch alarm with EC2 actions. The alarm should monitor the CPUUtilization metric and trigger an action to reboot the instance when the defined threshold (CPU utilization below 10% for 15 minutes) is breached. This approach is straightforward and designed for such operational tasks.
- A. Incorrect.
Incorrect. CloudWatch alarms can trigger Auto Scaling policies, but restarting a specific instance requires an EC2 action rather than an Auto Scaling policy.
- B. Correct.
Correct. CloudWatch alarms can monitor the CPUUtilization metric and directly trigger EC2 actions, such as rebooting or stopping an instance, when the specified conditions are met.
- C. Incorrect.
Incorrect. The StatusCheckFailed_System metric monitors system-level issues like failed hardware or networking, not CPU utilization. This metric is unrelated to the given scenario.
- D. Incorrect.
Incorrect. While EventBridge can monitor AWS events, using CloudWatch alarms is the more direct and appropriate solution for this use case.