amazon-web-servicesamazon-s3amazon-glacier

How does Lifecycle policy for moving s3 to glacier work?


I have created a lifecycle policy for one of my buckets as below:

Name and scope

Name MoveToGlacierAndDeleteAfterSixMonths

Scope Whole bucket

Transitions For previous versions of objects Transition to Amazon Glacier after 1 days

Expiration Permanently delete after 360 days

Clean up incomplete multipart uploads after 7 days

I would like to get answer for the following questions:

When would the data be deleted from s3 as per this policy ?

Do i have to do anything on the glacier end inorder to move my s3 bucket to glacier ?

My s3 bucket is 6 years old and all the versions of the bucket are even older. But i am not able to see any data in the glacier console though my transition policy is set to move to glacier after 1 day from the creation of the data. Please explain this behavior.

Does this policy affect only new files which will be added to the bucket post lifepolicy creation or does this affect all the files in s3 bucket ?

Please answer these questions.


Solution

  • When would the data be deleted from s3 as per this policy ?

    Never, for current versions. A lifecycle policy to transition objects to Glacier doesn't delete the data from S3 -- it migrates it out of S3 primary storage and over into Glacier storage -- but it technically remains an S3 object.

    Think of it as S3 having its own Glacier account and storing data in that separate account on your behalf. You will not see these objects in the Glacier console -- they will remain in the S3 console, but if you examine an object that has transitioned, is storage class will change from whatever it was, e.g. STANDARD and will instead say GLACIER.

    Do i have to do anything on the glacier end inorder to move my s3 bucket to glacier ?

    No, you don't. As mentioned above, it isn't "your" Glacier account that will store the objects. On your AWS bill, the charges will appear under S3, but labeled as Glacier, and the price will be the same as the published pricing for Glacier.

    My s3 bucket is 6 years old and all the versions of the bucket are even older. But i am not able to see any data in the glacier console though my transition policy is set to move to glacier after 1 day from the creation of the data. Please explain this behavior.

    Two parts: first, check the object storage class displayed in the console or with aws s3api list-objects --output=text. See if you don't see some GLACIER-class objects. Second, it's a background process. It won't happen immediately but you should see things changing within 24 to 48 hours of creating the policy. If you have logging enabled on your bucket, I believe the transition events will also be logged.

    Does this policy affect only new files which will be added to the bucket post lifepolicy creation or does this affect all the files in s3 bucket ?

    This affects all objects in the bucket.