Amazon S3 API has added Object Expiration which deleted all the files uploaded within a folder after few days.
Is it possible to make the same for each file from the day it was uploaded?
For example when I upload foo.png, after X days, delete that file not all the files within the folder.
Your file path is not more than a prefix in S3. So, if you have a structure as follows:
/
|
+--folder1
|
+--folder2
|
+--folder3
| |
| +--foo.png
| |
| +--foo2.png
|
+--bar.png
And you want your rule to apply only to foo.png, set it to "folder1/folder3/foo.png" (there will be only one file matching the "entire-name" prefix in your bucket).
But be aware of the limits regarding number of rules. From Object Expiration docs:
To set an object’s expiration, you add a lifecycle configuration to your bucket, which describes the lifetime of various objects in your bucket. A lifecycle configuration can have up to 100 rules. Each rule identifies an object prefix and a lifetime for objects that begin with this prefix. The lifetime is the number of days since creation when you want the object removed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With