Amazon S3 Event Notifications

With Amazon S3 being virtually unlimited in size, it’s quite a challenge to keep everything monitored especially when you are dealing with a large number of objects that scales up from time to time.

With Amazon S3 Event Notifications, you’ll be able to immediately know when an object in your bucket was created, removed or restored. This feature allows you to get notifications every time an event happens on your S3 bucket. These notifications can then be forwarded to Amazon Simple Notification Service (Amazon SNS) topic, Amazon Simple Queue Service (Amazon SQS) queue, and AWS Lambda. The S3 Event Notification feature supports multiple events like new object creation, object removal, object restoration, object loss as well as replication events for objects with S3 Replication Time Control (S3 RTC) enabled.

Configuring Amazon S3 Event Notifications

Let’s try a real-world application of this. Let’s say we want to receive an email notification every time an object is uploaded or removed from our bucket. To do this, we will need to configure our bucket to send a notification to SNS Topic, which will push an email notification to us.

Here, I created an SNS Topic named “S3EventNotification” with a configured access policy allowing S3 service to publish messages on SNS Topic. 

Access Policy

Tutorials dojo strip
{
  "Version": "2008-10-17",
  "Id": "example-ID",
  "Statement": [
    {
      "Sid": "s3-event-notifier",
      "Effect": "Allow",
      "Principal": {
        "Service": "s3.amazonaws.com"
      },
      "Action": "SNS:Publish",
      "Resource": "arn:aws:sns:ap-southeast-1:947117271373:S3EventNotification",
      "Condition": {
        "ArnLike": {
          "aws:SourceArn": "arn:aws:s3:::repo-load-script"
        }
      }
    }
  ]
}

Once you have your SNS Topic, create a subscription using your email address. Don’t forget to verify your email.

Amazon S3 Event Notifications1

Next, we need to configure events on our bucket. For this example, I have an empty bucket named repo-load-script.

Amazon S3 Event Notifications2
Go to Property Tab > Advanced Settings and select Events. You can select multiple events as triggers. For now, let’s select All object create events and All object delete events. Select SNS Topic as destination, choose a Topic, then click save.

Amazon S3 Event Notifications3

Let’s try uploading a text file to our bucket and let’s see if we are able to receive an email notification.

Amazon S3 Event Notifications4
Here’s the email notification received after uploading and deleting it. It contains necessary information like Event Name and Time, Bucket and Object Name, User Identity, and Source IP Address which are pretty helpful when investigating incidents like object deletion.

Amazon S3 Event Notifications5Final Thoughts

The Amazon S3 Notification feature is a simple yet effective way of monitoring bucket events. This can also be useful in processes that are dependent on bucket events. You have an option to send it to SNS topic (which we just did), trigger a Lambda Function, or send it to SQS queue which then can be consumed by another process later on. 

Sources:

https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
https://docs.aws.amazon.com/AmazonS3/latest/dev/ways-to-add-notification-config-to-bucket.html

Tutorials Dojo portal

FREE AWS Exam Readiness Digital Courses

Enroll Now – Our Azure Certification Exam Reviewers

azure reviewers tutorials dojo

Enroll Now – Our Google Cloud Certification Exam Reviewers

Tutorials Dojo Exam Study Guide eBooks

tutorials dojo study guide eBook

Subscribe to our YouTube Channel

Tutorials Dojo YouTube Channel

FREE Intro to Cloud Computing for Beginners

FREE AWS, Azure, GCP Practice Test Samplers

Browse Other Courses

Generic Category (English)300x250

Recent Posts

Written by: Lervin John Obando

Lervin is a Cloud Technology enthusiast and an AWS Community Builder whose expertise expands from Systems Administration, Database to Cloud Infrastructure. He is a Multi-Cloud Certified professional holding multiple certifications from AWS, Google, and Oracle. When he is not in front of his computer, you can find him spending time with his wife and dog.

AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!

Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!

View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses

Our Community

~98%
passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
200k+
students
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
~4.8
ratings
Our courses are highly rated by our enrollees from all over the world.

What our students say about us?