0
votes

I have a use case where I need to remove content from S3 buckets after 30 days without question. Using Boto3 I'd like to set a lifecycle policy on the S3 bucket itself to clear out the files and folders rather than having to manually run a script every so often. I've looked through the S3 documentation and I'm not seeing where the content can actually be specified to be deleted. I see where I can transfer that content to different storage tiers but that's it.

I'm referring to the documentation here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.BucketLifecycle.put

1

1 Answers

1
votes

In that documentation the "Expiration" and "NoncurrentVersionExpiration" are the actions that delete content (whereas "Transition"/"NoncurrentVersionTransition" are the ones to transition objects to a different storage, so you shouldn't include them in the configuration). The "Prefix" then identifies the objects to delete.