Why isn't the lifecycle rule on my Amazon S3 bucket working even though I applied it more than one day ago?
Last updated: 2019-12-20
I set a lifecycle configuration rule on my Amazon Simple Storage Service (Amazon S3) bucket to transition objects to another storage class or to expire objects. However, the objects haven't changed according to the rule. Why is this happening?
There might be a delay between when the lifecycle rule is satisfied and when the action for the rule is complete. Changes in billing are applied when the lifecycle rule is satisfied, even if the action hasn't been completed. Examples of this include:
- If you have a lifecycle rule for object expiration, then you won't be charged for storage after the object expiration time, even if the object isn't expired immediately.
- If you have a lifecycle rule to transition objects to the GLACIER storage class, then you're charged Amazon S3 Glacier storage rates when the object transition time elapses, even if the object isn't immediately transitioned to the GLACIER storage class.
Note: If you set a lifecycle transition to the INTELLIGENT_TIERING storage class, then changes in billing don't happen until the object has transitioned to the INTELLIGENT_TIERING storage class. This is the exception.
Additionally, Amazon S3 rounds the transition or expiration date of an object to midnight UTC the next day. For example, if you created an object on 1/1/2020 10:30 UTC, and you set the lifecycle rule to transition the object after 3 days, then the transition date of the object is 1/5/2020 00:00 UTC. Before you check whether a lifecycle rule has been satisfied, be sure to verify that enough time has elapsed.
If enough time has elapsed and your lifecycle rule still hasn't been satisfied, then verify that the prefix filter for the relevant objects is set correctly on the lifecycle rule. Examples include:
- If there's no prefix filter specified in the lifecycle rule, then the rule is applied to all objects in the bucket.
- If you specify a prefix filter as images/, then the lifecycle rule is applied to all objects under the prefix images/.
Note: Be sure that the / character is specified at the end of the prefix filter. The lifecycle rule won't be evaluated correctly if the / character is at the beginning of the prefix filter.