user2419831
user2419831

Reputation: 181

Amazon Glacier How to delete files after a certain period of time

Thanks for reading this.

I am able to transfer files from S3 to Glacier after 30 days using lifecycle rule. However, how do I make the same files get deleted from Glacier after 3 months?

Thanks.

Upvotes: 3

Views: 4521

Answers (2)

John Rotenstein
John Rotenstein

Reputation: 269101

If the objects were moved from S3 to Glacier via a Lifecycle Policy, add a permanently delete setting to the lifecycle policy to Delete the objects after n days. This will delete the objects from both S3 and Glacier.

If, instead, the objects were uploaded directly to Glacier, then there is no auto-deletion capability.

Upvotes: 2

Tom
Tom

Reputation: 1730

As far as I'm aware, Glacier does not currently have lifecycle policies for Glacier vaults like it does for S3.

You could create your own autodelete setup (likely within the not-expiring-after-12-months AWS Free Tier) by writing metadata about the Glacier archives to DynamoDB (vault name, archive id, timestamp) and have a scheduled Lambda function that looks for archives older than 30 days and deletes them from Glacier and DynamoDB.

It's a bit of work to set up, but it would accomplish what you're trying to do.

Upvotes: 1

Related Questions