---
title: "What is an S3 lifecycle rule?"
canonical: https://enum.co/learn/what-is-an-s3-lifecycle-rule
locale: en
topic: Storage
publishedAt: 2026-10-26
updatedAt: 2026-10-26
author: "Max Heyer"
summary: "An S3 lifecycle rule tells a bucket to act on objects automatically once they reach a set age or date, such as deleting old logs or versions."
---

# What is an S3 lifecycle rule?

An S3 lifecycle rule tells a bucket to act on objects automatically once they reach a set age or date, such as deleting old logs or versions.

After reading this you will be able to:

- Explain what a lifecycle rule filters on and which actions it runs
- Set expiry for current versions, old versions and delete markers
- Avoid common mistakes with versioned and locked buckets

## What is an S3 lifecycle rule?

An S3 lifecycle rule is a bucket setting that tells the storage system what to do with objects once they reach a certain age or date. Each rule picks a set of objects with a filter, then runs an action on them, most often deleting them. The bucket applies the rules on its own, with no script or cron job on your side.

Think of the "best before" date on food in a shared office fridge. Nobody has to check every item by hand: once the date passes, the item gets thrown out. A lifecycle rule puts that date on your objects and does the clearing out for you.

A bucket has one lifecycle configuration, and that configuration can hold many rules. Rules apply to objects that already exist as well as to new ones, so a fresh 30-day rule also catches everything older than 30 days.

## What is in a lifecycle rule?

Every rule has the same parts.

### ID and status

The ID is a name for the rule, so you can tell rules apart. The status is either enabled or disabled, and a disabled rule does nothing until you switch it back on.

### Filter

The filter decides which objects the rule touches. It can match a key prefix such as `logs/`, one or more object tags, or an object size range, and combined filters must all match. An empty filter applies the rule to the whole bucket.

### Actions

The action says what happens and when. Time is counted in days since the object was created or last overwritten, rounded up to the next midnight UTC. You can also give a fixed date, and then the rule keeps acting on every matching object after that date for as long as it stays enabled.

The common actions are:

- **Expiration** deletes the current version of an object after a number of days or on a date, or hides it behind a delete marker in a versioned bucket.
- **Noncurrent version expiration** permanently deletes old versions a set number of days after they were replaced, optionally keeping the newest few.
- **Expired delete marker removal** cleans up delete markers that have no versions left behind them.
- **Abort incomplete multipart uploads** stops uploads that never finished, so their parts stop using space.
- **Transition** moves objects to a cheaper storage class, where a provider has more than one.

## How do lifecycle rules work with versioning?

In a bucket without versioning, expiration deletes the object for good. With versioning on, expiration only adds a delete marker on top. The old data stays as a noncurrent version and keeps using space.

To really free that space, add a noncurrent version expiration action. A delay of a few days gives you time to restore something deleted by mistake. A third action that removes expired delete markers keeps listings clean.

### Object Lock and other limits

Lifecycle rules do not delete versions that are still under an Object Lock retention period. A bucket policy that denies deletes does not stop lifecycle rules either. Removal also runs in the background, so an object can stay visible for a while after its expiry date.

## How enum handles S3 lifecycle rules

[enum Object Storage](/object-storage) supports lifecycle rules that expire objects and old versions automatically, alongside versioning and Object Lock. It has one storage class, so there is nothing to transition to, and rules are about expiry. For a specific action, such as aborting incomplete multipart uploads, ask us.

## FAQ

**Does a lifecycle rule delete objects at the exact moment they expire?**
No. The day count rounds up to the next midnight UTC, and removal runs in the background after that. Plan for some delay, and do not use lifecycle rules for deletions with a hard deadline.

**Why does my versioned bucket keep growing after I set an expiration rule?**
Expiration on a versioned bucket only adds a delete marker, and the replaced data stays as a noncurrent version. Add a noncurrent version expiration action so old versions are removed after a set number of days.

**Can a lifecycle rule delete data protected by Object Lock?**
No. Versions under an active retention period stay until that period ends. Set the noncurrent version expiry a little longer than the lock period, so the rule cleans up shortly after the lock expires.
