How to configure s3 Event Notification – s3 Event Blog

You could configure s3 Bucket based on event to notify via message in AWS. s3 supports different types of event notification on object level. The objects are act as incoming source for your event configuration and each event notification could be notified further via other integration and compute services such as SNS, SQS and Lambda.

Event notification message could be sent to the following targets

Simple Notification Service (SNS) topic – This acts as a communication channel and helps in sending the message to an endpoint.

Simple Queue Service (SQS) queue – Its a secure message queue service that helps to exchange message through different systems.

Lambda Function – This provides a platform to run your application code without worrying about the infrastructure. You could create a function with custom code in various supported languages and integrate different services.

s3 event notification can be sent for following types of events.

Object Create Event – You could select either one or more object creation actions such as PUT, POST, COPY and CompleteMultiPartUpload or could choose ObjectCreated(All) to enable notification during event configuration in your bucket.

Object Delete Events – Same like Object Create event, you could select either ObjectDelete(All) to configure your s3 event notification or could select Permanently Deleted for a version enabled object deletion. You could also select Delete Marker Created when a delete marker is created on a versioned object. So that you would be notified anytime an object is deleted from your bucket.

Restore object Events – The event configuration can be configured based on the restoration of an object from Glacier.You could select Restore Initiated when a restore is initiated and Restore Completed when a restore is completed from Glacier.

Reduced Redundancy Storage (RRS) Events – You could configure your bucket event notification and could be notified when an RRS storage object is lost.

Replication Event – You could configure event notification, if you have replication with s3 Replication Time Control (RTC) is enabled.

Now we would configure the Event notification and would would it in this article.

Configure Event Notification

1. Sign in to AWS Management Console (link) and open s3 Service

2. Select your Bucket and go to Properties

3. Go to Advance Settings and Click on Events

4. Click on Add Notification

5. Provide all details to your Event

  • Name – Provide a name to your event
  • Events – As we explained above, we could set events based on various action on s3 object. For now lets select All Object create events and All Object delete events.
  • Prefix (Optional) – You could add a prefix, if you want to limit the notification to objects with keys that start with matching character
  • Suffix (Optional) – This is also to limit the notification to objects with matching character
  • Send To – This is the destination where you want to send your event notification. We would proceed with SNS Topic here for this blog. Provide the SNS details and Proceed

6. Click on Save to complete the Event Notification Set Up

Test the Event Configuration

Here, we would test twice to make sure as per setup we are receiving the notification for both object creation and deletion.

Case 1 – Create a new object in s3

Case 2 – Delete an Object

As we observed in both the cases, the event configuration worked fine as expected.

Please comment below for any questions related to this blog.

Leave a Reply