Discover how to leverage Amazon CloudWatch alarms to monitor and automatically restart EC2 instances when CPU utilization exceeds a specified threshold, ensuring optimal performance with minimal operational overhead.
Table of Contents
Question
A company is experiencing issues with legacy software running on Amazon EC2 instances. Errors occur when the total CPU utilization on the EC2 instances exceeds 80%. A short-term solution is required while the software is being rewritten. A SysOps administrator is tasked with creating a solution to restart the instances when the CPU utilization rises above 80%.
Which solution meets these requirements with the LEAST operational overhead?
A. Write a script that monitors the CPU utilization of the EC2 instances and reboots the instances when utilization exceeds 80%. Run the script as a cron job.
B. Add an Amazon CloudWatch alarm for CPU utilization and configure the alarm action to reboot the EC2 instances.
C. Create an Amazon EventBridge rule using the predefined patterns for CPU utilization of the EC2 instances. When utilization exceeds 80%, invoke an AWS Lambda function to restart the instances.
D. Add an Amazon CloudWatch alarm for CPU utilization and configure an AWS Systems Manager Automation runbook to reboot the EC2 instances when utilization exceeds 80%.
Answer
B. Add an Amazon CloudWatch alarm for CPU utilization and configure the alarm action to reboot the EC2 instances.
Explanation
This solution leverages Amazon CloudWatch alarms to monitor EC2 instance CPU utilization and automatically reboot the instances when the CPU utilization exceeds 80%. It requires the least operational overhead compared to the other options.
Here are the steps to implement this solution:
- Open the Amazon CloudWatch console.
- Create a new alarm for the EC2 instances based on the “CPUUtilization” metric.
- Set the alarm threshold to trigger when the CPU utilization exceeds 80% for a specified period.
- Under “Actions,” choose “Reboot this instance” as the action to take when the alarm is triggered.
By configuring the CloudWatch alarm to reboot the instances directly, no additional scripts, Lambda functions, or automation runbooks are required. CloudWatch will automatically monitor the CPU utilization and take the necessary action to reboot the instances when the threshold is breached.
This solution provides a straightforward and low-maintenance approach to address the issue with the legacy software without introducing additional operational overhead.
Other options have higher operational overhead:
A. Writing a custom script and running it as a cron job requires ongoing maintenance and monitoring of the script itself.
C. Using Amazon EventBridge and invoking a Lambda function introduces additional complexity and potential points of failure.
D. Creating an AWS Systems Manager Automation runbook requires additional configuration and management compared to the direct CloudWatch alarm action.
Amazon AWS Certified SysOps Administrator – Associate certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Amazon AWS Certified SysOps Administrator – Associate exam and earn Amazon AWS Certified SysOps Administrator – Associate certification.