An organization runs a memory-sensitive workload on a standalone Amazon EC2 instance. To ensure stability, the instance must be automatically rebooted if the custom metric `AvailableMemory`—which is published every `` minutes to a custom namespace—falls below `` MB for two consecutive evaluation periods (a total of `` minutes). Which two configuration steps should a SysOps Administrator perform to achieve this requirement?
- Create a CloudWatch alarm on the `AvailableMemory` metric with a threshold of `` MB, a period of `` minutes, and evaluation periods set to ``.Answer
- Configure an Amazon EventBridge rule that matches the CloudWatch alarm's state change to `ALARM`, and set the target to the `AWS-RestartEC2Instance` Systems Manager Automation runbook.Answer
- CAdd an EC2 reboot action directly to the CloudWatch alarm configuration to restart the instance when the alarm enters the `ALARM` state.
- DEnable detailed monitoring on the EC2 instance to increase the reporting frequency of the `AvailableMemory` custom metric to `-minute` intervals.
- EConfigure an Auto Scaling group scaling policy with a `-minute` cooldown period to trigger the reboot action.
Answer
The SysOps Administrator must create a CloudWatch alarm with a threshold of `` MB, a `-minute` period, and `` evaluation periods, and configure an Amazon EventBridge rule targeting the `AWS-RestartEC2Instance` Systems Manager Automation runbook on alarm state changes.
To satisfy the requirements, the CloudWatch alarm must evaluate the `AvailableMemory` metric over a `-minute` period for `` consecutive evaluation periods to span the `-minute` window. Additionally, since the metric belongs to a custom namespace, the built-in EC2 actions (such as reboot or recover) cannot be attached directly to the alarm. Instead, an Amazon EventBridge rule must be configured to intercept the alarm's state change to `ALARM` and trigger the `AWS-RestartEC2Instance` Systems Manager Automation runbook to reboot the instance.
Step-by-Step Solution
Key Concept
CloudWatch Custom Metric Alarms and Remediation Actions