Event notification types and destinations
Amazon S3 supports several event notification types and destinations where the notifications can be published. You can specify the event type and destination when configuring your event notifications. Only one destination can be specified for each event notification. Amazon S3 event notifications send one event entry for each notification message.
Topics
Supported event destinations
Amazon S3 can send event notification messages to the following destinations.
-
Amazon Simple Notification Service (Amazon SNS) topics
-
Amazon Simple Queue Service (Amazon SQS) queues
-
AWS Lambda
-
Amazon EventBridge
However, only one destination type can be specified for each event notification.
Note
You must grant Amazon S3 permissions to post messages to an Amazon SNS topic or an Amazon SQS queue. You must also grant Amazon S3 permission to invoke an AWS Lambda function on your behalf. For instructions on how to grant these permissions, see Granting permissions to publish event notification messages to a destination.
Amazon SNS topic
Amazon SNS is a flexible, fully managed push messaging service. You can use this service to push messages to mobile devices or distributed services. With SNS, you can publish a message once, and deliver it one or more times. Currently, Standard SNS is only allowed as an S3 event notification destination, whereas SNS FIFO is not allowed.
Amazon SNS both coordinates and manages sending and delivering messages to subscribing endpoints or clients. You can use the Amazon SNS console to create an Amazon SNS topic that your notifications can be sent to.
The topic must be in the same AWS Region as your Amazon S3 bucket. For
instructions on how to create an Amazon SNS topic, see Getting started with
Amazon SNS in the Amazon Simple Notification Service Developer Guide and the Amazon SNS FAQ
Before you can use the Amazon SNS topic that you created as an event notification destination, you need the following:
-
The Amazon Resource Name (ARN) for the Amazon SNS topic
-
A valid Amazon SNS topic subscription. With it, topic subscribers are notified when a message is published to your Amazon SNS topic.
Amazon SQS queue
Amazon SQS offers reliable and scalable hosted queues for storing messages as they travel between computers. You can use Amazon SQS to transmit any volume of data without requiring other services to be always available. You can use the Amazon SQS console to create an Amazon SQS queue that your notifications can be sent to.
The Amazon SQS queue must be in the same AWS Region as your Amazon S3 bucket. For instructions on how to create an Amazon SQS queue, see What is Amazon Simple Queue Service and Getting started with Amazon SQS in the Amazon Simple Queue Service Developer Guide.
Before you can use the Amazon SQS queue as an event notification destination, you need the following:
-
The Amazon Resource Name (ARN) for the Amazon SQS queue
Note
Amazon Simple Queue Service FIFO (First-In-First-Out) queues aren't supported as an Amazon S3 event notification destination. To send a notification for an Amazon S3 event to an Amazon SQS FIFO queue, you can use Amazon EventBridge. For more information, see Enabling Amazon EventBridge.
Lambda function
You can use AWS Lambda to extend other AWS services with custom logic, or create your own backend that operates at AWS scale, performance, and security. With Lambda, you can create discrete, event-driven applications that run only when needed. You can also use it to scale these applications automatically from a few requests a day to thousands a second.
Lambda can run custom code in response to Amazon S3 bucket events. You upload your custom code to Lambda and create what's called a Lambda function. When Amazon S3 detects an event of a specific type, it can publish the event to AWS Lambda and invoke your function in Lambda. In response, Lambda runs your function. One event type it might detect, for example, is an object created event.
You can use the AWS Lambda console to create a Lambda function that uses the AWS infrastructure to run the code on your behalf. The Lambda function must be in the same Region as your S3 bucket. You must also have the name or the ARN of a Lambda function to set up the Lambda function as an event notification destination.
Warning
If your notification writes to the same bucket that triggers the notification, it could cause an execution loop. For example, if the bucket triggers a Lambda function each time an object is uploaded, and the function uploads an object to the bucket, then the function indirectly triggers itself. To avoid this, use two buckets, or configure the trigger to only apply to a prefix used for incoming objects.
For more information and an example of using Amazon S3 notifications with AWS Lambda, see Using AWS Lambda with Amazon S3 in the AWS Lambda Developer Guide.
Amazon EventBridge
Amazon EventBridge is a serverless event bus, which receives events from AWS services. You can set up rules to match events and deliver them to targets, such as an AWS service or an HTTP endpoint. For more information, see What is EventBridge in the Amazon EventBridge User Guide.
Unlike other destinations, you can either enable or disable events to be delivered to EventBridge for a bucket. If you enable delivery, all events are sent to EventBridge. Moreover, you can use EventBridge rules to route events to additional targets.
Supported event types for SQS, SNS, and Lambda
Amazon S3 can publish events of the following types. You specify these event types in the notification configuration.
Event types | Description |
---|---|
|
When a notification is enabled, Amazon S3 publishes a test notification. This is to ensure that the topic exists and that the bucket owner has permission to publish the specified topic. If enabling the notification fails, you don't receive a test notification. |
|
Amazon S3 API operations such as
|
|
By using the You can request notification when an object is deleted or a
versioned object is permanently deleted by using the
These event notifications don't alert you for automatic deletes from lifecycle configurations or from failed operations. |
|
By using the The |
s3:ReducedRedundancyLostObject |
You receive this notification event when Amazon S3 detects that an object of the RRS storage class is lost. |
|
By using the
|
|
By using the The |
s3:LifecycleTransition |
You receive this notification event when an object is transitioned to another Amazon S3 storage class by an S3 Lifecycle configuration. |
s3:IntelligentTiering |
You receive this notification event when an object within the S3 Intelligent-Tiering storage class moved to the Archive Access tier or Deep Archive Access tier. |
|
By using the The |
s3:ObjectAcl:Put |
You receive this notification event when an ACL is PUT on an object or when an existing ACL is changed. An event is not generated when a request results in no change to an object’s ACL. |
Supported event types for Amazon EventBridge
For a list of event types Amazon S3 will send to Amazon EventBridge, see Using EventBridge.
Event ordering and duplicate events
Amazon S3 Event Notifications is designed to deliver notifications at least once, but
they aren’t guaranteed to arrive in the same order that the events occurred. On rare
occasions, Amazon S3’s retry mechanism might cause duplicate S3 Event Notifications for
the same object event. For more about handling duplicate or out of order events, see
Manage event ordering and duplicate events with Amazon S3 Event
Notifications