Learn how to set up SNS to receive real-time email updates on activity in S3 and be able to identify business reasons for doing so.
- [Tutor] Now that we've configured our SNS topic to publish message to our email, and to receive messages from the S3 bucket, we'll go into the demo primary bucket and set up our notifications. You want the Properties tab here and then scroll down to Events. This UI as you can see allows us to Add Notification. Now if you look a little further down in the middle of the section here, you can see that we have a lot of options as to the kind of actions that we can be alerted on. Now let's say that the contents to this bucket are sensitive and I want to make sure that they are never ever deleted, so I want to get notifications if that ever happens.
So I can choose Delete or Delete Marker Created, or I can uncheck those and choose ObjectDelete parenthesis all which covers every possible deletion scenario. I need to give a name to this notification so we'll call it S3DemoDeleteAlert. Now if I didn't want this alert to apply to every object in the bucket, I could give a prefix or a suffix to filter the objects that will be under this alert. However that's not what I want. I want it to apply to everything in the bucket so I'll leave these two options blank, and then go down to the Send to section.
You can see that we have three different targets here: SNS, SQS, and Lambda, which will allow us to run some code say Python or Java, in response to the message that's going to go out. We just set up an SNS Topic so we'll choose that option. Now the next option updates so we can choose the demo notification that we just created, and hit Save. Now we have one active event notification. In order to see it in action, we need to trigger it by deleting an object. So head back to the Overview tab and scroll down.
Alright, apricots and bananas, you're getting deleted. Choose Delete from the More dropdown after you select their check boxes. Confirm the delete and they're gone. Now if we go back to email, into the inbox, you can see already we have messages that say these objects were deleted. If you take a look, there's a fairly complex message. This is json that describes exactly what happened. But if you look closely or if you put this json into a json editor, you can see what's going on.
You see we have event name, object removed. We have the name of the bucket and we have the key that is the path to the object that was deleted. These kinds of messages can give you key insight into what's happening in your S3 bucket. And if you hook these messages up to a Lambda, your options get even lighter. You can take any action in AWS that you might need to take, you could set a cloud watch alert, or you could enter a record into a database that creates an auto-log for the fact that this delete happened.
You have a lot of options here and S3 Event notifications make it possible.
Join AWS architect Brandon Rich and learn how to configure object storage solutions and lifecycle management in Simple Storage Service (S3), a web service offered by AWS, and migrate, back up, and replicate relational data in RDS. Find out how to leverage flexible network storage with Elastic File System (EFS), and use the new AWS Glue service to move and transform data. Plus, learn how Snowball can help you transfer truckloads of data in and out of the cloud.
- What is data management?
- AWS S3 basics
- S3 bucket creation
- S3 upload and logging
- S3 event notifications
- S3 data lifecycle configuration
- Working with Amazon Elastic Block Store volumes
- Creating and mounting an EFS
- Creating an AWS RDS instance
- RDS backup and recovery
- Moving data with AWS Database Migration Service
- Moving data with Data Pipeline and Glue