- Newest
- Most votes
- Most comments
I think your configuration is valid. The behavior you are observing is not caused by a conflict with S3 Object Lock, but rather by the asynchronous execution of S3 Lifecycle policies.
Because the 1-day Governance retention period expired on Day 1, your object version is no longer WORM-protected. It is fully eligible to be permanently deleted by the NoncurrentVersionExpiration rule without needing any bypass headers or special permissions.
Here is the actual timeline of what is happening in the background:
-
S3 Lifecycle rules are evaluated once a day at midnight UTC.
-
When your noncurrent version officially qualifies for permanent expiration (Day 5 in your timeline), S3 does not delete it instantly. Instead, it flags the object and places it into an asynchronous backend queue for removal.
-
It typically takes an additional 24 to 48 hours (and sometimes longer, depending on bucket size and region load) for the backend process to physically delete the objects and for them to disappear from the list-object-versions API response.
Resolution: Do not change your configuration or build manual deletion scripts. Your JSON setup—including the best-practice rule to clean up expired delete markers—is exactly how it should be configured. Just wait another 1-2 days. The asynchronous S3 Lifecycle queue will process and clear the noncurrent versions automatically.
Reference:
-
AWS Knowledge Center: Why aren't my Amazon S3 Lifecycle rules working? (See section: "There's a delay in the lifecycle rule's execution" -> https://repost.aws/knowledge-center/s3-lifecycle-rule-delay )
-
AWS Storage Blog: Maintaining object immutability (Confirms that configuring a NoncurrentVersionExpiration rule permanently deletes noncurrent versions automatically "after their retention period expires" -> https://aws.amazon.com/blogs/storage/maintaining-object-immutability-by-automatically-extending-amazon-s3-object-lock-retention-periods/ )
AWS Documentation:
-
AWS Knowledge Center: Why aren't my Amazon S3 Lifecycle rules working? (See section: "There's a delay in the lifecycle rule's execution" -> https://repost.aws/knowledge-center/s3-lifecycle-rule-delay)
-
AWS Docs: Lifecycle and object expiration (Quote: "Amazon S3 queues it for removal and removes it asynchronously. There might be a delay between the expiration date and the date at which Amazon S3 removes an object." -> https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-expire-general-considerations.html )
Thanks for the reply Florian Turnwald. We will wait for 2-3 days more to see if the non current version objects are getting deleted and will revert back to this post.
The issue you're experiencing is expected behavior when S3 Object Lock is enabled on a bucket. When Object Lock is configured, even in GOVERNANCE mode, it fundamentally changes how lifecycle policies interact with object versions.
Here's what's happening:
Object Lock and Lifecycle Policy Interaction: When Object Lock is enabled on a bucket, the NoncurrentVersionExpiration lifecycle action cannot permanently delete noncurrent object versions that were protected by Object Lock, even after their retention period has expired. The Object Lock protection remains associated with the object version throughout its lifecycle.
Why Your Noncurrent Versions Aren't Being Deleted: Even though your Object Lock retention period (1 day) has expired and the object has become noncurrent (after Day 4 when the delete marker was created), the lifecycle policy's NoncurrentVersionExpiration action is unable to remove these versions because they were originally created with Object Lock protection.
Resolution Options:
-
Manual Deletion with Bypass Permission: To delete noncurrent versions that were protected by Object Lock in GOVERNANCE mode, you need to explicitly bypass the governance retention. This requires the
s3:BypassGovernanceRetentionpermission and must be done manually using a DELETE request with thex-amz-bypass-governance-retention: trueheader. -
Reconsider Object Lock Usage: If your use case allows, evaluate whether Object Lock is necessary for your retention requirements. If you only need lifecycle-based expiration without write-once-read-many (WORM) protection, you might consider using lifecycle policies alone without Object Lock.
-
Adjust Retention Strategy: If Object Lock is required for compliance, understand that you'll need to implement a separate process to clean up noncurrent versions after their retention periods expire, as lifecycle policies alone cannot handle this automatically.
The lifecycle policy is working correctly for creating delete markers (expiring current versions), but the permanent deletion of noncurrent versions requires additional handling when Object Lock is involved.
Sources
NoncurrentVersionExpiration - Amazon Simple Storage Service
Deleting object versions from a versioning-enabled bucket - Amazon Simple Storage Service
Relevant content
asked 3 years ago
asked 2 years ago
- AWS OFFICIALUpdated a year ago
