Why isn't my Amazon S3 lifecycle configuration rule transitioning objects into the GLACIER storage class?
Last updated: 2020-12-23
I set an Amazon Simple Storage Service (Amazon S3) Lifecycle configuration rule on my S3 bucket that transitions objects to the GLACIER storage class. However, when I check my bucket, the storage class of my objects hasn't changed. What's causing the delay?
There might be a delay in transitioning objects into the GLACIER storage class for the following reasons:
- If the objects are in the STANDARD_IA storage class, the objects must be stored in STANDARD_IA for at least 30 days before transitioning to GLACIER. Before you check that the rule transitioned the storage class, confirm that the objects have been stored in STANDARD_IA for at least 30 days.
- Amazon S3 Lifecycle configuration rules run once a day at midnight UTC. Before you check that the rule transitioned the storage class, confirm that it's after midnight UTC in your time zone.
- The total number of objects in the bucket affects the time it takes for you to see the change in storage class. If the bucket contains a large number of objects, then it might take longer to see the change in storage class.
Note: After objects are eligible for transitioning to a different storage class, you're charged based on the pricing of the new storage class.
After the expected waiting time for your use case, you can check the change in storage class by running the list-objects-v2 command:
aws s3api list-objects-v2 --bucket awsexamplebucket --prefix prefixname/ --query 'Contents[?StorageClass==`GLACIER`&&ends_with(Key, `/`) == `false`].[Key]' --output text | while read line1; do printf '\n'$line1'\n'; aws s3api head-object --bucket awsexamplebucket --key $line1 --query '[Restore]' --output text; done
Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent AWS CLI version.