My application uses Amazon S3 to store some files, uploaded by customer. I want to set a rule that automatically should watch for particular folder's content, specifically - to delete files, that were created month ago. Is that possible?
The subfolders DO get deleted when the retention policy set to: "This rule applies to all objects in the bucket". Hopefully, an option will be added soon to AWS retention policy so that it can be set to no include Folders. Hope this helps !
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to create a lifecycle rule for. Choose the Management tab, and choose Create lifecycle rule. In Lifecycle rule name, enter a name for your rule.
Lifecycle policies apply to both existing and new S3 objects, ensuring that you can optimize storage and maximize cost savings for all current data and any new data placed in S3 without time-consuming manual data review and migration.
Amazon S3 has a flat structure instead of a hierarchy like you would see in a file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects.
Yes you can set a rule that automatically should watch for particular folder's content, specifically - to delete files, that were created month ago.
For this go to 'lifecycle policy' -> 'Expiration'. In 'Expiration' section set prefix as the path to files that you want to apply your rule.
For example: If I want to apply rule to 'fileA.txt' in folder 'myFolder' in bucket 'myBucket'. Then I should set prefix as 'myFolder/'.
Amazon S3 has a flat structure with no hierarchy like you would see in a typical file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects. Amazon S3 does this by using key name prefixes for objects.
For more info refer: http://docs.aws.amazon.com/AmazonS3/latest/UG/FolderOperations.html
Yes. You can setup an S3 lifecycle policy that will make S3 automatically delete all files older than X days: http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectExpiration.html
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