> For the complete documentation index, see [llms.txt](https://docs.weka.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.weka.io/3.14/additional-protocols/s3/s3-information-lifecycle-management.md).

# S3 Information Lifecycle Management

This page describes how to define information lifecycle rules for S3 buckets.

## Overview

For S3 buckets, it is possible to set information lifecycle rules to apply to the objects within the bucket. The ILM rules apply to the data within the bucket, no matter by which protocol it has been created.

### Rules Evaluation

Weka currently only supports rules for expiring objects and allows you to set different expirations per object prefix and tags. Up to 1000 rules per bucket are supported. If multiple rules are overlapping, the rule with the earliest expiration that applies for an object deletes this object from the bucket.

## Managing Rules

### Creating an ILM Rule

**Command:** `weka s3 bucket lifecycle-rule add`

Use the following command line to create an ILM rule:

`weka s3 bucket lifecycle-rule add <bucket> <expiry-days>  [--prefix prefix] [--tags tags]`

**Parameters in Command Line**

| **Name**      | **Type** | **Value**                                            | **Limitations**                             | **Mandatory** | **Default** |
| ------------- | -------- | ---------------------------------------------------- | ------------------------------------------- | ------------- | ----------- |
| `bucket`      | String   | The name of the S3 bucket                            |                                             | Yes           |             |
| `expiry-days` | Number   | The number of days to wait before expiring an object | Minimum of 1 day                            | Yes           |             |
| `prefix`      | String   | The prefix of objects to apply the rule to           |                                             | No            |             |
| `tags`        | String   | Key value pair of object tags to apply the rule to   | Pairs of key values: `'<k1>=<v1>&<k2=<v2>'` | No            |             |

{% hint style="info" %}
**Note:** The `expiry-days` is the minimum time to wait before expiring an object. In extreme load and scale cases, it might take longer than the `expiry-days` to delete an object.
{% endhint %}

### Viewing ILM Rules <a href="#viewing-ilm-rules" id="viewing-ilm-rules"></a>

**Command:** `weka s3 bucket lifecycle-rule list`‌

Use the following command line to view a bucket's existing ILM rules:‌

`weka s3 bucket lifecycle-rule list <bucket>`‌

**Parameters in Command Line**

| **Name** | **Type** | **Value**                 | **Limitations** | **Mandatory** | **Default** |
| -------- | -------- | ------------------------- | --------------- | ------------- | ----------- |
| `bucket` | String   | The name of the S3 bucket | ​Content        | Yes           | ​Content    |

### Deleting an ILM Rule

**Command:** `weka s3 bucket lifecycle-rule remove`

Use the following command line to delete an ILM rule:

`weka s3 bucket lifecycle-rule remove <bucket> <rule>`

**Parameters in Command Line**

| **Name** | **Type** | **Value**                    | **Limitations** | **Mandatory** | **Default** |
| -------- | -------- | ---------------------------- | --------------- | ------------- | ----------- |
| `bucket` | String   | The name of the S3 bucket    |                 | Yes           |             |
| `rule`   | String   | The ID of the rule to delete |                 | Yes           |             |

### Resetting a Bucket's ILM Rules

**Command:** `weka s3 bucket lifecycle-rule reset`

Use the following command line to delete all the ILM rules of a specified bucket:

`weka s3 bucket lifecycle-rule reset <bucket>`

**Parameters in Command Line**

| **Name** | **Type** | **Value**                 | **Limitations** | **Mandatory** | **Default** |
| -------- | -------- | ------------------------- | --------------- | ------------- | ----------- |
| `bucket` | String   | The name of the S3 bucket |                 | Yes           |             |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.weka.io/3.14/additional-protocols/s3/s3-information-lifecycle-management.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
