Skip to content

AWS S3: Delete a file x days after last modification

0

I'm struggling with the following use case in AWS S3 and life cycle rules:

In my application, a user can ask for file deletion.

When it does i want to keep the file 90 days and then delete it.

I don't want to delete the file 90 days after the date it was created (uploaded)

For example:

I have a life cycle rule in my bucket that will expires files with tag "to_delete" 90 days after creation date.

I upload file for the first time in bucket: last modified date is today (creation date), let's say D1.

In 3 days i edit the file, i add the "to_delete" tag: last modified date is D1 + 3 days, let's say D3.

Will the life cycle rule apply 90 days from today (D1) or from today + 3 days (D3) ?

  • Have you enabled versioning? And is the modified object name going to remain the same?

  • No bucket versioning is not enabled and yes the modified object will still have the same name

asked 4 years ago1.9K views
1 Answer
0

How about i add a to_delete tag and a to_delete metadata when the user wants to deletes the file. If my understanding is correct, if a file metadata is added aws creates a copy of the file which would resolves the problem of the creation date ?

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.