Question: Why isn't the lifecycle rule on my Amazon S3 bucket working even though I applied it more than one day ago?

I set a lifecycle configuration rule on my Amazon Simple Storage Service (Amazon S3) bucket to transition objects to another storage class, or expire objects. However, the objects didn't change according to the rule.

ResolutionThis happens when there's 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 isn't complete.Example:If you have a lifecycle rule for object expiration, then you aren't charged for storage after the expiration time. This is applicable even if the object isn't immediately expired.A lifecycle rule to transition objects to the GLACIER storage class charges the Amazon S3 Glacier storage rates when the object transition time elapses. This occurs 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 billing changes don't happen until the object transitions to the INTELLIGENT_TIERING storage class. This is an exception.S3 lifecycle runs only once per day. Additionally, Amazon S3 rounds the transition or expiration date of an object to midnight UTC the next day. For example, you create an object on 1/1/2020 10:30 UTC with a lifecycle rule to transition the object after 3 days. For this object, the transition date is 1/5/2020 00:00 UTC. Before you check whether a lifecycle rule is satisfied, be sure to verify that enough time elapsed.If enough time elapsed and your lifecycle rule isn't satisfied, then check that you correctly set the prefix filter for objects on the lifecycle rule. Important:If you don't specify a prefix filter 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 to specify the / character at the end of the prefix filter. If you specify the / character at the beginning of the prefix filter, then the lifecycle rule isn't correctly evaluated.You can use the HeadObject API or Amazon S3 console to check when a current version object is scheduled to expire.Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent version of the AWS CLI.Run the following AWS CLI command to know when the object expires:$ aws s3api head-object --bucket bucketname --key file.txtThe output looks similar to the following one: {   "AcceptRanges": "bytes",   "Expiration": "expiry-date=\"Wed, 15 Mar 2023 00:00:00 GMT\", rule-id=\"MyExpirationRule\"",   "LastModified": "2023-02-22T17:20:34+00:00",   "ContentLength": 6,   "ETag": "\"edae42exa0d2b93b123346740107dacf\"",   "VersionId": "SoshCRUrlabc1v4ZzYEA123PvWcaeF6F",   "ContentType": "text/plain",   "ServerSideEncryption": “AES256”,   "Metadata": {}  }The Expiration response header provides the expiry-date and rule-id. The expiry-date field indicates the date when Amazon S3 queues the object for removal and removes the object asynchronously. The rule-id field indicates the lifecycle rule that's applied to the object.To use the Amazon S3 console to check an object's expiration date, complete the following steps:Open the Amazon S3 console.From the Buckets list, choose the name of your bucket.Choose the name of the object that you want to check.Choose the Properties tab.In the Object Management Overview section, under Management Configurations, review the Expiration rule and Expiration date fields.The Expiration date field indicates the date when Amazon S3 queues the object for removal and removes the object asynchronously. The Expiration rule field indicates the lifecycle rule that's applied to the object.Note: Only current version objects return the Expiration response header for HEAD or GET requests. Previous versions and delete markers don't return this response header. Also, you don't get response headers for objects that are eligible for transitions.You can use the S3 Storage Lens dashboards to monitor the progress of active lifecycle rules and updates made by the lifecycle rules.

Related informationSetting lifecycle configuration on a bucket