myPavi
myPavi

Reputation: 211

Is there a life cycle policy that i can setup to move the files in s3 bucket to a folder on a daily basis

I have a requirement to roll all the files that are in S3 every day to a folder with in s3 e.g. folder name is the date. Can I setup any lifecycle managment for this purpose.I am looking for some out of box solution/configuration instead of aws command line.

Upvotes: 1

Views: 4269

Answers (2)

ajselvar
ajselvar

Reputation: 1

You can use S3's replication policy to copy the object from a source to destination S3 bucket. Along with it you can configure a life cycle policy to delete the objects in source bucket after a certain duration

Ref: https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication.html https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html

Upvotes: 0

Michael - sqlbot
Michael - sqlbot

Reputation: 178956

Lifecycle policies never change paths. They only change storage classes and/or purge objects.

S3 is an object store, not a filesystem. A better design would probably be to store the objects in the correct place, initially, rather than trying to move them. Moving 1000 objects requires 2000 or 3000 API requests -- copy, verify, delete. There is no atomic "move" or "rename" operation, and there are no folder-level or wildcard operations. Anything that appears to do that -- including the S3 console -- is emulating it with copy [+ verify] + delete requests for the individual objects.

Upvotes: 3

Related Questions