> For the complete documentation index, see [llms.txt](https://docs.eazybackup.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eazybackup.com/e3-object-storage/advanced/e3-bucket-lifecycle-rules-automatic-object-expiration.md).

# e3 Bucket Lifecycle Rules (Automatic Object Expiration)

Create and manage lifecycle rules from the Buckets Management tab or AWS CLI.

Lifecycle rules automate expiration, transition, and cleanup for objects in a bucket — for example, deleting logs after 90 days or removing old versions.

## Dashboard (recommended)

1. Open **e3 Object Storage → Buckets**.
2. Select a bucket and open the **Management** tab.
3. In **Lifecycle rules**, click **Create rule** (or **Refresh** / **Edit** / **Delete** on existing rules).

The lifecycle editor supports:

| Action                                       | Use for                                       |
| -------------------------------------------- | --------------------------------------------- |
| **Expire current versions**                  | Delete objects after N days from creation.    |
| **Permanently delete noncurrent versions**   | Clean up old versions (requires versioning).  |
| **Delete expired object delete markers**     | Reclaim space after version deletes.          |
| **Abort incomplete multipart uploads**       | Remove stalled uploads after N days.          |
| **Transition current / noncurrent versions** | Move to another storage class when available. |

**Scope:**

* **All objects**, or **Limit with filters** — prefix, object tags, min/max object size.

**Rule name** — unique ID (e.g. `archive-logs-90d`).

{% hint style="info" %}
Noncurrent version actions are disabled when **versioning** is off on the bucket.
{% endhint %}

Rules are evaluated periodically (typically daily). Objects may remain briefly after their expiry day until the next evaluation cycle.

See Buckets and Versioning and Object Lock.

## AWS CLI (optional)

You can also apply lifecycle configuration with the AWS CLI and a JSON file — useful for automation or copying rules between buckets.

Connection settings: Connection details.

```bash
aws s3api put-bucket-lifecycle-configuration \
  --bucket your-bucket-name \
  --lifecycle-configuration file://lifecycle.json \
  --endpoint-url https://s3.ca-central-1.eazybackup.com \
  --profile e3
```

Example `lifecycle.json` — expire all objects after 90 days:

```json
{
  "Rules": [
    {
      "ID": "ExpireObjectsAfter90Days",
      "Filter": { "Prefix": "" },
      "Status": "Enabled",
      "Expiration": { "Days": 90 }
    }
  ]
}
```

To remove all lifecycle rules via CLI:

```bash
aws s3api delete-bucket-lifecycle \
  --bucket your-bucket-name \
  --endpoint-url https://s3.ca-central-1.eazybackup.com \
  --profile e3
```

## Versioning notes

* With **versioning enabled**, expiring current versions often creates **delete markers**; use noncurrent expiration rules to remove older versions.
* Test rules on a non-production bucket first.

## Related

* Configure e3 Bucket Quotas — hard caps on bucket size or object count.
