100 Days of DevOps — Day 7(AWS S3 Event)

Prashant Lakhera
3 min readFeb 17, 2019

--

Check the updated 101 Days of DevOps Course

Course Registration link: https://www.101daysofdevops.com/register/

Course Link: https://www.101daysofdevops.com/courses/101-days-of-devops/

YouTube link: https://www.youtube.com/user/laprashant/videos

Welcome to Day 7 of 100 Days of DevOps, Let extend the journey of DevOps Monitoring and Alerting with S3 events.

Problem Statement

  • Whenever anyone deletes any object in S3 bucket you will get the notification

Solution

This can be achieved via in one of the three ways

  • AWS Console
  • Terraform

NOTE: This is not the complete list and there are more ways to achieve the same

What is S3 Event?

The Amazon S3 notification feature enables you to receive notifications(SNS/SQS/Lambda) when certain events(mentioned below)happen in your bucket.

Just to re-iterate the same thing S3 events work at the object level, so if something happens to the object, in this case, maybe PUT, POST, COPY or DELETE then the event is generated and that event will be delivered to the target(SNS, SQS or LAMBDA)

To Configure S3 events

  • Paste this json policy(We still need permission on SNS topic to allow S3 event system to deliver events to it)
* Give your event a name
* Event type I want to get a notification is (All object delete events) i.e I want to recieve notification when object is deleted from this topic.
* Send to SNS Topic
* SNS(Choose the SNS topic you created earlier)

For more info about SNS

  • Now if you try to delete an object from the bucket

NOTE: Delivery of these events happens in almost real-time with no cost involved.

Terraform Code

GitHub link

For more info about supported events type

NOTE: This is not a completely automated solution, you need to go to a particular topic and Create Subscription. For complete info

Looking forward from you guys to join this journey and spend a minimum an hour every day for the next 100 days on DevOps work and post your progress using any of the below medium.

Reference

--

--

Prashant Lakhera
Prashant Lakhera

Written by Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP

No responses yet