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?
- 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.Cevap
- BConfigure 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.
- CEnable 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.
- DConfigure 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.
Cevap
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.
Adım Adım Çözüm
Anahtar Kavram
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.
Tahmini Süre:1m 30s