Recently we had terrible day someone from team deleted terraform state file. so we thought implementing alerts on s3. is there any way we can alert(send notifications)?
CodePudding user response:
You can use CloudTrail SNS to generate alerts about S3 object creation and deletion like so:
https://asecure.cloud/a/cwalarm_s3_creation_deletion/
Here's a user guide from AWS that may help you as well: https://docs.aws.amazon.com/AmazonS3/latest/userguide/NotificationHowTo.html
There's a nice video from 2018 about how to get SNS notifications to get alerts about S3 object creation/deletion. Check that out also: https://www.youtube.com/watch?v=EGyuzMbXD0Y
The other couple of practices you could us are:
- enable versioning
- create policies so users cannot delete objects
- enable object locking
- replicate bucket to a different region
- optionally, keep a air-gapped copy outside of AWS S3 for critical files
That'll prevent an important file from being accidentally deleted.
CodePudding user response:
Amazon S3 Events can send notifications when objects in an Amazon S3 bucket are created or deleted.
The notification can:
- Send a message to an Amazon SNS Topic
- Send a message to an Amazon SQS Queue
- Trigger an AWS Lambda function