Question

Difficulty: EasyEvent-Driven Automation and Operational Responses

A SysOps administrator needs to automatically stop any Amazon EC2 instance that transitions to the running state in a development AWS account. Which configuration will achieve this with the least operational overhead?

  1. A
    Configure an Amazon EventBridge rule that filters for EC2 Instance State-change Notification events, and configure the target to be an AWS Config custom compliance rule that triggers an instance shutdown.
  2. Create an Amazon EventBridge rule that filters for EC2 Instance State-change Notification events where the state is running, and configure the target to execute the AWS-StopEC2Instance Systems Manager Automation runbook.Answer
  3. C
    Create an Amazon EventBridge rule that targets the Systems Manager Automation runbook, configuring an IAM service role for EventBridge but omitting the iam:PassRole permission from the administrator's policy.
  4. D
    Enable detailed monitoring on the EC2 instances to reduce the state-change metric latency to 1 minute, and configure a CloudWatch alarm to trigger an Auto Scaling policy that stops the instance.

Answer

Create an Amazon EventBridge rule that filters for EC2 Instance State-change Notification events where the state is running, and configure the target to execute the AWS-StopEC2Instance Systems Manager Automation runbook.
The correct answer is to use an Amazon EventBridge rule that filters for EC2 Instance State-change Notification events and targets the AWS-StopEC2Instance runbook. EventBridge provides a direct, native, and near-real-time integration with Systems Manager Automation without requiring additional monitoring configurations or custom code, making it the option with the least operational overhead.

Step-by-Step Solution

1
Identify the event source and event type for EC2 instance state changes.
The event source is 'aws.ec2' and the detail-type is 'EC2 Instance State-change Notification' with the state set to 'running'.
This allows Amazon EventBridge to detect the state change immediately when the instance starts.
2
Select a remediation target that requires the least development and operational overhead.
The AWS-StopEC2Instance runbook provided by Systems Manager Automation can stop the instance without writing custom code.
Using an out-of-the-box Systems Manager runbook is more efficient than writing a custom AWS Lambda function.
3
Configure an EventBridge rule that connects the event source to the target runbook with the necessary IAM execution permissions.
An EventBridge rule is created to capture the running state event and trigger the Systems Manager Automation target.
This establishes the complete event-driven automation loop.

Key Concept

Using Amazon EventBridge rules to target AWS Systems Manager Automation runbooks for automated event-driven remediation of resource states.
Estimated Time:1m 0s
Rate this question