Question

Difficulty: MediumCloudWatch Metrics and Alarms

A SysOps Administrator is designing an automated remediation workflow to restart a legacy service running on an Amazon EC2 instance. The restart must occur when a custom CloudWatch metric, FailureCount, exceeds a threshold of 5 failures within a 5-minute period. The administrator has already created a CloudWatch alarm that transitions to the ALARM state when this threshold is met. What is the correct and most efficient method to automatically trigger the service restart when the alarm enters the ALARM state?

  1. Configure an Amazon EventBridge rule that detects CloudWatch Alarm State Change events for the specific alarm, and set the rule's target to an AWS Systems Manager Automation document that runs the restart command on the instance.Answer
  2. B
    Configure the CloudWatch alarm's actions directly to invoke an AWS Systems Manager Automation document by specifying the document's ARN in the alarm notification settings.
  3. C
    Enable detailed monitoring on the EC2 instance and configure an AWS Config rule to monitor the FailureCount metric, setting its remediation target to the restart command.
  4. D
    Configure an Auto Scaling group lifecycle hook that triggers an SNS notification to restart the service, and set the scaling cooldown period to 0 seconds to ensure immediate execution.

Answer

Configure an Amazon EventBridge rule that detects CloudWatch Alarm State Change events for the specific alarm, and set the rule's target to an AWS Systems Manager Automation document that runs the restart command on the instance.
The correct answer utilizes Amazon EventBridge to bridge the CloudWatch alarm state change event and the Systems Manager Automation document. Because CloudWatch alarms cannot directly invoke Systems Manager Automation or run scripts on EC2 instances, EventBridge is the standard and recommended service to route these operational state changes to SSM for automated remediation.

Step-by-Step Solution

1
Identify the capabilities and limitations of direct CloudWatch alarm actions.
Confirm that CloudWatch alarms cannot directly target SSM Automation or Run Commands.
This rules out direct configuration of SSM actions inside the CloudWatch alarm console.
2
Determine the integration path between CloudWatch alarms and Systems Manager remediation.
Use Amazon EventBridge to capture the 'CloudWatch Alarm State Change' event.
EventBridge acts as the event bus that routes state transitions to external targets like SSM.
3
Configure the EventBridge rule target to execute the reboot or restart task.
Select the target as the Systems Manager Automation document and pass the EC2 instance ID.
This executes the necessary operational task automatically on the target instance when the event triggers.

Key Concept

CloudWatch alarms cannot directly trigger Systems Manager Automation documents or Run Commands; an event-driven router like Amazon EventBridge is required to capture the Alarm State Change event and trigger the remediation document.
Estimated Time:1m 30s
Rate this question