Triggering Lambda on EC2 State Changes

Answer Correct answer: A — Amazon EventBridge is the appropriate service to invoke a Lambda function when an EC2 instance enters the stopping state.

A user wants to invoke an AWS Lambda function when an Amazon EC2 instance enters the “stopping” state. Which AWS service is appropriate for this use case?

  1. Amazon EventBridge Correct Answer
  2. AWS Config
  3. Amazon Simple Notification Service (Amazon SNS)
  4. AWS CloudFormation

Community Votes

A
100%

100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

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.

Community Discussion (4 comments)

ShaiTay 👍 1 Selected: A
A. Amazon EventBridge - allows you to set up event-driven workflows based on state changes of resources
its_tima 👍 1
EventBridge is for event-driven cases
Meow7 👍 2
A is correct please help with discussion on 503 ~ 511
Naantje 👍 1
answer A is correct. https://repost.aws/knowledge-center/start-stop-lambda-eventbridge

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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

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?

CloudWatch Alarms are primarily for metrics (CPU, memory), not instance states. While you can create custom metrics for states, EventBridge natively listens to instance state changes via the EC2 API.

Why is SNS not the best answer here?

SNS is a notification delivery service. It doesn't know about EC2 states itself. You would typically use EventBridge to catch the state change and then publish to SNS if needed, making EventBridge the primary trigger.

More CLF-C02 FAQ →

Related Analysis

Practice All CLF-C02 Questions

Access 120 questions with complete answers and detailed explanations.

View Full CLF-C02 Practice Test →

← Back to CLF-C02 Study Guide