Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS storage: S3 object go to Glacier if never accessed in the last month

i am storing objects to S3, i would like that object never accessed in the last month go to glacier.

After some research i don't think i can achieve this, but i hope to be wrong.

When creating lifecycle for an s3 bucket the rule is based on object creation date (not last access date)

Setting the storage class for the object will not help according to http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html

"You cannot associate an object with the Glacier storage class as you upload it. You transition existing Amazon S3 objects to the Glacier storage class by using lifecycle management. For more information, see Object Lifecycle Management."

Does anyone know how can achieve this?

Thanks

like image 401
Riccardo Casatta Avatar asked Sep 05 '25 03:09

Riccardo Casatta


1 Answers

You cannot add conditional policies that apply to objects in S3 object lifecycle configuration which in your case is, is based on the object's last access time.

You can however transition objects to Glacier based on their age or on a specific date.

I would like to think you can handle it in your application but the s3 object returned does not have the last access time, if you use the the AWS SDK.

Details here

like image 170
Noman Ur Rehman Avatar answered Sep 07 '25 22:09

Noman Ur Rehman