Study guide
Technical reference and lesson notes
Purpose of This Lesson
Amazon S3 Event Notifications let you react automatically when activity occurs in an S3 bucket. This lesson focuses on recognizing S3 event types, choosing an appropriate destination, configuring the required resource-based permissions, and understanding when Amazon EventBridge provides more advanced routing and filtering.
Key Concepts
S3 Events
Events represent changes or actions involving objects in an S3 bucket, including:
- Object creation
- Object removal
- Object restoration
- Replication activity
S3 Event Notifications can be filtered. For example, a notification can be limited to objects whose names end in .jpeg.
Common Use Case
A typical workflow is to generate thumbnails whenever image files are uploaded to S3. An event filter can limit processing to relevant image objects, and the notification can invoke a downstream service automatically.
Notification Destinations
S3 events can be sent to:
- An Amazon SNS topic
- An Amazon SQS queue
- An AWS Lambda function
- Amazon EventBridge
The first three destinations support direct S3 Event Notification integrations. EventBridge provides a broader event-routing model with additional filtering, destinations, and event-management capabilities.
S3 Event Notification Architecture and Permissions
S3 Event Notifications are generally delivered within seconds, although delivery can sometimes take a minute or longer. Applications should therefore account for asynchronous delivery rather than assuming immediate processing.
The destination must authorize S3 to publish, send, or invoke. The required permission is a resource-based policy attached to the destination:
| Destination | Required authorization |
|---|---|
| SNS topic | SNS resource access policy allowing the S3 bucket or S3 service to publish |
| SQS queue | SQS resource access policy allowing S3 to send messages |
| Lambda function | Lambda resource policy allowing S3 to invoke the function |
A key distinction is that these integrations use resource access policies on the destination. The lesson does not describe using an IAM role for S3 to perform these notification actions. This is conceptually similar to using an S3 bucket policy: the resource receiving the request defines who is allowed to access it and what action is permitted.
EventBridge Integration
The lecture describes S3 events as also being available through Amazon EventBridge. EventBridge rules can route events to more than 18 AWS services, including destinations such as:
- AWS Step Functions
- Amazon Kinesis Data Streams
- Amazon Kinesis Data Firehose
Compared with basic S3 event filtering, EventBridge supports more advanced filtering based on information such as object metadata, object size, and object name. It can also send an event to multiple destinations.
EventBridge adds event-management features such as event archiving and replay, along with more reliable delivery capabilities described in the lesson. Use it when the workflow requires complex routing, multiple targets, richer filtering, or the ability to retain and replay events.
Exam- or Assessment-Relevant Takeaways
- S3 Event Notifications are used to react to object and bucket activity automatically.
- Recognize object creation, removal, restoration, and replication as event categories covered by the lesson.
- Basic destinations are SNS, SQS, and Lambda; EventBridge is an additional integration option.
- Direct destination integrations require resource-based policies on the SNS topic, SQS queue, or Lambda function.
- Do not confuse these destination policies with an IAM role assumed by S3.
- Basic S3 filtering can identify objects by characteristics such as a filename suffix, including
.jpeg. - EventBridge is the stronger choice when advanced filtering, multiple destinations, archiving, replay, or broader AWS service integration is needed.
- Event delivery is asynchronous and may take seconds or, occasionally, a minute or longer.
Tool / Feature Decision Guide
| Requirement | Suitable choice | Reason |
|---|---|---|
| Publish an S3 event to a fan-out notification topic | SNS | The S3 notification can target an SNS topic, subject to the topic resource policy. |
| Queue events for downstream consumption | SQS | SQS provides a queue destination, subject to an SQS resource access policy. |
| Run code in response to an event | Lambda | S3 can invoke the function when its Lambda resource policy permits invocation. |
Filter a straightforward event, such as image uploads ending in .jpeg | Basic S3 Event Notification | Simple event and object-name filtering is sufficient. |
| Filter using object metadata, size, and name together | EventBridge | EventBridge provides more advanced filtering. |
| Deliver the same event to multiple services | EventBridge | EventBridge rules can route events to multiple destinations. |
| Use Step Functions, Kinesis Streams, or Kinesis Firehose as targets | EventBridge | These are examples of broader EventBridge destination options described in the lesson. |
| Retain events for later use or process them again | EventBridge | EventBridge supports event archiving and replay. |
Common Traps / Misconceptions
- Assuming notifications are always instantaneous: Delivery is usually within seconds but can take a minute or longer.
- Using an IAM role as the main authorization model: The destination resource policy is what authorizes S3 to publish, send, or invoke.
- Confusing SQS and SNS: SQS is a queue destination, while SNS is a topic-based notification destination.
- Treating basic S3 filters as equivalent to EventBridge rules: EventBridge supports richer filtering based on metadata, size, and name.
- Forgetting the Lambda permission: Creating a Lambda function alone is not enough; its resource policy must allow S3 invocation.
- Assuming one destination is the only option: S3 events can integrate with SNS, SQS, Lambda, and EventBridge, with EventBridge supporting multiple downstream destinations.
- Ignoring file-name filtering: A workflow intended for images can process unintended objects unless an appropriate suffix or other supported filter is configured.
Real-World Engineer / Analyst Notes
- Design downstream consumers for asynchronous delivery and occasional delay.
- Keep event filters narrow when only a subset of objects should trigger processing; this reduces unnecessary work in workflows such as thumbnail generation.
- When troubleshooting a missing notification, verify both the event filter and the destination resource policy.
- For Lambda targets, check that S3 is authorized to invoke the specific function.
- For SNS and SQS targets, inspect the topic or queue policy rather than looking only at the S3 bucket configuration.
- Start with direct S3 notifications for simple one-destination workflows. Move to EventBridge when routing, filtering, replay, archiving, or multiple targets become important.
Quick Reference Summary
- Purpose: React automatically to events occurring in S3.
- Events: Creation, removal, restoration, and replication activity.
- Direct targets: SNS, SQS, and Lambda.
- Expanded target and routing option: EventBridge.
- Authorization: Resource-based policy on the destination.
- Simple filtering: For example, object names ending in
.jpeg. - Advanced filtering: EventBridge can use metadata, object size, and name.
- Delivery model: Usually seconds, but sometimes a minute or longer.
- EventBridge capabilities: Multiple destinations, broader AWS service integration, archiving, replay, and more reliable delivery as described in the lesson.
Flashcards
Q: A workflow should generate thumbnails only for newly uploaded JPEG images. What S3 Event Notification design fits this requirement?
A: Configure an object-creation notification with a filename suffix filter such as .jpeg, then send it to Lambda or another suitable processing destination.
Q: Which resource must authorize S3 to publish an event to an SNS topic?
A: The SNS topic’s resource access policy must allow the S3 bucket or S3 service to publish messages.
Q: Which resource-based permission is required when S3 sends notifications to SQS?
A: The SQS queue policy must authorize S3 to send messages to the queue.
Q: What permission allows S3 to trigger a Lambda function?
A: A Lambda resource policy attached to the function must allow S3 to invoke it.
Q: Why are destination resource policies important in S3 Event Notifications?
A: They grant the receiving SNS topic, SQS queue, or Lambda function permission to accept the S3-originated action. The integration is not based on an IAM role for S3 in the workflow described here.
Q: When should EventBridge be preferred over a basic S3 Event Notification configuration?
A: Use EventBridge when advanced filtering, multiple destinations, broader AWS service targets, archiving, replay, or enhanced delivery capabilities are needed.
Q: What kinds of filtering does the lecture associate with EventBridge?
A: EventBridge can filter using object metadata, object size, and object name, providing more advanced options than basic S3 filtering.
Q: When is a direct S3 notification to SQS a better fit than Lambda?
A: Choose SQS when the requirement is to place events in a queue for downstream consumers rather than immediately invoke a function.
Q: When is SNS a suitable S3 event destination?
A: SNS is suitable when S3 should publish event messages to a notification topic, with the topic policy authorizing the publish action.
Q: What is the delivery-timing assumption engineers should make for S3 Event Notifications?
A: Delivery is typically within seconds but may take a minute or longer, so consumers should not depend on instantaneous arrival.
Q: What additional routing capability does EventBridge provide compared with a single direct target?
A: EventBridge rules can route events to multiple destinations and to a wider range of AWS services, including Step Functions and Kinesis options.
Q: What is the operational trap when a Lambda-based S3 notification does not execute?
A: The event configuration may exist, but the Lambda resource policy may not allow S3 to invoke the function.
Practice Questions
Question 1
A data engineer wants S3 object events to trigger a thumbnail-generation function only when the uploaded object name ends with .jpeg. Which design best matches the requirement?
A. Send every S3 event to an SQS queue without filtering
B. Configure an S3 object-creation notification with a .jpeg suffix filter and target Lambda
C. Use an SNS topic with no resource policy
D. Use EventBridge archiving without an event rule
Correct answer: B
The decisive clues are the object-creation trigger, the filename suffix filter, and the need to execute processing code. The Lambda resource policy must also permit S3 invocation.
Question 2
An S3 notification is configured to publish to an SNS topic, but no messages arrive. Which permission should be checked first?
A. An IAM role attached to the S3 bucket
B. The SNS topic’s resource access policy
C. The Lambda execution role
D. The SQS visibility timeout
Correct answer: B
S3-to-SNS delivery requires an SNS resource access policy that authorizes the S3-originated publish action.
Question 3
A company needs to route S3 events using object metadata and size, send each event to multiple AWS services, and replay retained events later. Which option is the best fit?
A. A basic S3 suffix filter targeting one Lambda function
B. An SQS queue with no filtering
C. Amazon EventBridge rules and its event-management features
D. An SNS topic with a Lambda execution role
Correct answer: C
EventBridge is the option described as supporting advanced filtering, multiple destinations, archiving, and replay.
Question 4
An engineer assumes that an S3 event notification failure means the event was lost because it did not arrive immediately. What is the most accurate interpretation?
A. S3 notifications are guaranteed to arrive instantly
B. S3 notifications are synchronous with the object operation
C. Delivery is usually within seconds but can sometimes take a minute or longer
D. Events are delivered only through Lambda
Correct answer: C
The lesson describes notifications as asynchronous, with typical delivery within seconds but possible delays of a minute or longer.
WordPress Metadata
Suggested Slug:
aws-s3-event-notifications-eventbridge
Meta Description:
Learn how AWS S3 Event Notifications use SNS, SQS, Lambda, and EventBridge, including filtering, resource policies, delivery timing, and routing decisions.
Tags:
AWS, Amazon S3, S3 Event Notifications, Amazon EventBridge, Amazon SNS, Amazon SQS, AWS Lambda, resource-based policies, event-driven architecture, data engineering, AWS Certified Data Engineer Associate