Question

Difficulty: MediumCloudWatch Metrics and Alarms

An application team wants to automatically reboot an Amazon EC2 instance when a custom application metric, `TransactionFailureRate`, exceeds a threshold. A SysOps Administrator configures a CloudWatch alarm to monitor this metric. The administrator needs to trigger the `AWS-RestartEC2Instance` Systems Manager (SSM) Automation runbook when the alarm enters the ALARM state, but finds that CloudWatch alarms cannot directly target SSM Automation runbooks. Which configuration should the administrator use to achieve this goal?

  1. A
    Enable detailed monitoring on the EC2 instance to allow the CloudWatch alarm to directly target the Systems Manager Automation runbook.
  2. Create an Amazon EventBridge rule that triggers when the CloudWatch alarm state changes to ALARM, and specify the Systems Manager Automation runbook as the target.Answer
  3. C
    Configure the CloudWatch alarm to send an Amazon Simple Queue Service (Amazon SQS) message to a queue, and configure the Systems Manager Automation runbook to poll the queue.
  4. D
    Configure an Auto Scaling group cooldown period on the EC2 instance to pause metric collection while the Systems Manager Automation runbook is executing.

Answer

Create an Amazon EventBridge rule that triggers when the CloudWatch alarm state changes to ALARM, and specify the Systems Manager Automation runbook as the target.
The correct configuration uses Amazon EventBridge to bridge the gap because CloudWatch alarms cannot directly target Systems Manager Automation runbooks. When a CloudWatch alarm changes state, it emits an event to the default EventBridge event bus. An EventBridge rule can match this state change event (e.g., transition to ALARM) and trigger the Systems Manager Automation runbook (AWS-RestartEC2Instance) to reboot the target EC2 instance.

Step-by-Step Solution

1
Identify the destination limits of Amazon CloudWatch alarms.
CloudWatch alarms can natively send notifications to SNS, perform EC2 actions (like reboot), or trigger Auto Scaling policies, but cannot directly invoke Systems Manager Automation runbooks.
This establishes the need for an intermediary service to route the alarm transition event.
2
Determine the service designed to handle resource state changes and route them to targets.
Amazon EventBridge captures CloudWatch alarm state change events (specifically transitions to the ALARM state) as event patterns.
EventBridge acts as the event router between CloudWatch alarms and other AWS services.
3
Select the appropriate target for the EventBridge rule.
Configure the Systems Manager Automation runbook (AWS-RestartEC2Instance) as the target of the EventBridge rule, specifying the target EC2 instance ID.
This completes the event-driven workflow to automatically reboot the instance upon alarm trigger.

Key Concept

Integrating CloudWatch Alarms with Systems Manager Automation using EventBridge
Rate this question