In this video, let’s take a look at how to automatically clean obsolete objects from your s3 bucket using LifeCycle rule.
This tutorial builds on my previous two videos and in those two tutorials I show how to setup serverless Email for a custom domain using AWS services.
I used AWS SES, that’s Simple Email Service as a SMTP endpoint for your website or newsletter distribution, AWS S3 to store the incoming emails. I also setup an AWS Lambda function to forward those incoming emails stored in S3 to my gmail destination.
If we are forwarding those emails then we also need to clean up the S3 bucket of old emails otherwise they will take up storage and costs. So with Lifecycle rule you can routinely have AWS delete older objects/files automatically.
- Create a Lifecycle rule in the S3 bucket to remove old emails.
- Goto S3 bucket
- Click on Management
- Click on Create lifecycle rule
- Give a name for the Rule
- Choose scope to be All objects and acknowledge **
- For Actions select Expire, Permanently Delte and Delete expired markers
- Give 5, 5, 5 for the days.
- Click Create Rule