How to successfully delete versioned files in S3
Hi,
How do I delete groups of versioned files in S3? I have thousands of files and do not want to have to select to delete each file. I have added a Lifecycle rule but it does not seem to be deleting the versions.
Thanks,
Hello
What issue do you have deleting non current versions through lifecycle?
There is a great blog post around using lifecyle policies for noncurrent versions : https://aws.amazon.com/blogs/storage/reduce-storage-costs-with-fewer-noncurrent-versions-using-amazon-s3-lifecycle/
Lifecycle policies are a great mechanism for current and non-current versions of objects. You can select how many versions to keep as well as number of days after which the non-current version of the object should be deleted. You can apply this at a prefix level or bucket level for filtering.
Hi
Once you define a lifecycle rule for a noncurrent objects for a given prefix , you also need to configure 'Days after objects become noncurrent" and "number of newer objects to retain". Please follow the blog instructions as it will show you step by step.
As always test this with a small number of objects e.g. instead of using 300, you can use the 300/2006/1 to delete objects under that prefix.
Once the lifecycle is configured, there might be a delay in seeing the effect. See below article that explains it in detail. https://aws.amazon.com/premiumsupport/knowledge-center/s3-lifecycle-rule-delay/
Relevant questions
A lambda function to delete old archive files in s3 bucket
asked 3 years agoDeleting User - Do files remain?
asked 2 months agoDeny deleted Glacier class storage files
asked 3 years agoI want to close my AWS account what do I save
asked a month agoHow to successfully delete versioned files in S3
Accepted Answerasked a month agoS3 Bucket Delete Marker Policy Not Working
asked 3 months agoHow do I restore deleted files in S3?
asked 4 months agolooking for automation to Delete S3 files with specific Extension and date
Accepted Answerasked 21 days agoHow can we set s3 lifecycle rule to delete the files form S3 bucket!
asked 2 months agoHow to delete old files deployed in S3 with CodePipeline
asked 2 months ago
Thanks for the reply
I have a bucket with multiple prefixes e.g. bucket1\300\2006\1 I would like to delete all versioned objects from 300 down II have a lifecylce rule with the following options checked Expire current versions of objects Permanently delete noncurrent versions of objects and a prefix of 300 but the versions are not being deleted