Skip to main content
In a versioned bucket, every overwrite or delete keeps the previous version, and noncurrent versions are billed as storage like any other object. Without a lifecycle rule they are kept forever. nOps looks for versioned buckets storing a lot of noncurrent versions with no rule to expire them, and estimates the saving from expiring versions after 90 days.

Why it matters

Buckets that are written often can hold many times more data in old versions than in current objects.

How nOps finds it

nOps uses S3 Storage Lens metrics for each bucket: the bytes held by noncurrent versions. The saving is that storage at the bucket’s billed Standard storage rate. Storage Lens does not show how old the versions are, so the estimate is an upper bound for a 90-day rule.

Before you start

S3 Storage Lens metrics for the bucket, and permission to update lifecycle rules (s3:GetLifecycleConfiguration, s3:PutLifecycleConfiguration). Know your recovery and compliance requirements for old versions.

How to implement

  1. Check versioning and Object Lock on the bucket: aws s3api get-bucket-versioning --bucket BUCKET.
  2. Decide how long you need old versions for recovery, for example 90 days.
  3. Save the current lifecycle rules, then add a rule with Permanently delete noncurrent versions of objects after that many days (NoncurrentVersionExpiration with NoncurrentDays), keeping every existing rule.
  4. Write back the full merged configuration with put-bucket-lifecycle-configuration, since it replaces every rule.
  5. Update Terraform or CloudFormation with the same rule.

Risks and considerations

  • Expired versions are deleted permanently, so you can no longer restore objects to those versions.
  • Current versions are never affected.
  • Object Lock retention still applies; locked versions are not deleted until their retention ends.
  • To roll back, restore the saved lifecycle rules. Versions already expired cannot be recovered.