I'm looking to delete S3 objects after they're not used for a certain amount of time.
Specifically, there should be two rules:
- move them to glacier after a certain time they're unused (6 months)
- delete them after they've been in glacier for 2 weeks
The objects are in a versioned bucket. I also know that there's a deletion fee for glacier objects deleted before 90 days, but that's not a problem.
Now, I can easily accomplish objective 1 via an Intelligent-Tiering Archive configuration
.
However, I don't know if it's possible to accomplish object 2 - when I look at the lifecycle rules, I can't find a way to specify that I want to delete all the versions (current and past) of an object that has been in Glacier (Archive) for 2 weeks.
The only way I can think of modeling this problem is:
- Create an "Intelligent-Tiering Archive configuration" that moves to archive after 6 months, and to deep archive after 2 weeks
- Create a lambda that expires and deletes all the version of objects in deep archive.
This has two disadvantages:
- I'll pay for deep archive storage even if it's virtually unused (but that's not a big deal)
- I'll need to write a Lambda
Is there a simpler solution?