Triggering Lambda on EC2 State Changes
Short answer
A Amazon EventBridge is the appropriate service to invoke a Lambda function when an EC2 instance enters the stopping state.
Question
Key Takeaways
The question tests knowledge of cloud-native event routing, where the common trap is confusing general notification services with centralized event buses that handle infrastructure state changes.
Amazon EventBridge is the correct AWS service for triggering a Lambda function when an EC2 instance enters a specific state like stopping. This page explains how EventBridge enables event-driven architectures based on resource lifecycle changes.
Common mistake: Candidates often incorrectly choose Amazon SNS, assuming it handles all notifications; however, SNS does not natively listen to EC2 state transitions without additional configuration or layers.
Expert Analysis
Why the Answer Is Correct
Amazon EventBridge (formerly CloudWatch Events) is the appropriate service because it acts as a serverless event bus that can detect state changes in AWS resources, such as an EC2 instance entering the 'stopping' state. You can create an EventBridge rule that matches this specific state change and targets an AWS Lambda function as the action. This allows for automated, event-driven workflows without manual polling.
Why the Other Options Are Wrong
AWS Config tracks configuration changes and compliance over time but is not designed for real-time invocation of functions based on simple state transitions like stopping. Amazon Simple Notification Service (SNS) is a pub/sub messaging service that delivers notifications but does not inherently monitor EC2 states; it requires a source (like EventBridge or CloudWatch) to push events to it. AWS CloudFormation is an infrastructure-as-code service used for provisioning and managing resources, not for runtime event handling or automation triggers.
Community Comment Notes
The community consensus strongly supports Option A, with users noting that EventBridge is specifically designed for "event-driven workflows based on state changes." One commenter referenced the official AWS knowledge center article confirming that EventBridge is the standard way to start/stop instances or trigger actions on their lifecycle. Another user simply stated, "EventBridge is for event-driven cases," reinforcing the core concept tested.
Official Reference
- https://repost.aws/knowledge-center/start-stop-lambda-eventbridge
- https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule-console.html
These links open the official vendor documentation in a new tab.
Exam Strategy
When asked about triggering actions based on resource state changes (start, stop, terminate), immediately think of EventBridge. It is the central hub for AWS events and is the most efficient way to decouple infrastructure changes from application logic.
Frequently Asked Questions
Can I use CloudWatch Alarms instead of EventBridge?
Why is SNS not the best answer here?
Community Votes
100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
Meow7 👍 2A is correct please help with discussion on 503 ~ 511
-
ShaiTay 👍 1 Answered AA. Amazon EventBridge - allows you to set up event-driven workflows based on state changes of resources
-
Naantje 👍 1answer A is correct. https://repost.aws/knowledge-center/start-stop-lambda-eventbridge
-
its_tima 👍 1EventBridge is for event-driven cases
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All CLF-C02 Questions
Access 120 questions with complete answers and detailed explanations.
View Full CLF-C02 Practice Test →