> ## Documentation Index
> Fetch the complete documentation index at: https://help.nops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Expire Noncurrent S3 Object Versions

> Add an S3 lifecycle rule that expires old noncurrent object versions in versioned buckets.

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.

| | |
| - | - |
| **Cloud** | AWS |
| **Category** | Storage |
| **Service** | Amazon S3 |
| **Action** | Modify |
| **Effort** | Low |
| **Source** | nOps |

## 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.

## Related

* [Abort Incomplete S3 Multipart Uploads](https://help.nops.io/inform/supported-recommendations/abort-incomplete-s3-multipart-uploads)
* [Switch S3 Bucket to Intelligent-Tiering](https://help.nops.io/inform/supported-recommendations/switch-s3-bucket-to-intelligent-tiering)
* [Supported recommendations](https://help.nops.io/inform/supported-recommendations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.