Reputation: 125
We have a use case where we need to delete the files from Amazon S3 after two days.
So lets suppose our bucket name is BucketA and in BucketA we have three folders namely:-
We want to delete all the files inside the bucket except the the folder3.
Can you please how we can achieve this.I tried deletion using S3 rule but it doesnt seem to work
How we can apply the exclusion logic for folder 3.
Thank in advance.
Upvotes: 0
Views: 333
Reputation: 4070
In your s3 bucket you can setup expiration rules. They can be applied by a combination of prefixes, and tags.
That mean that you could either:
folder1
, and another one with prefix folder2
, orfolder3
files. For instance you could add a tag has_ttl:true
to all files in folder1
and folder2
and use an expiration rule based on this tag, orfolder3
files to another s3 bucketAs far as I know, it is not possible to write an exclusion rule for expiration policy.
Upvotes: 2