# Lifecycle Rule

## <mark style="color:green;">**Overview**</mark> <a href="#overview" id="overview"></a>

**Lifecycle rules** for files/folders (Objects) must be clearly defined according to usage needs.

*For example:*

* *You need to upload a large amount of data and want these files to only exist for 90 days.*
* *Enable versioning for the Bucket, but because the number of file versions is large, it takes up much storage space.*
* *Multipart files are not fully uploaded, and parts of the files are still on the system, leading to a waste of storage space.*

Managing Lifecycle rules will help you solve the above problems. In a Bucket, you can create multiple Lifecycle rules to apply only to folders or all files and folders, depending on your needs.

## <mark style="color:green;">**Procedure**</mark> <a href="#procedure" id="procedure"></a>

{% stepper %}
{% step %}
**Step 1:** Right-click into Bucket and choose **Lifecycle rules**

<figure><img src="/files/3Ji3fBuKl2bAhpodW5jq" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
**Step 2:** Click on “**New Rule**” to create the Rules

<figure><img src="/files/dNZNeVBBKnv11bJSPZ08" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Step 3:** Set up the rules you want to apply to your bucket and set the days you need to apply. After choosing the Rules, click “**Add New Rule**”.

* **Permanently delete file**: It will remove all versions of the object from the bucket, including any archived versions, making it unrecoverable once deleted.
* **Permanently deleting previous versions:** It will remove older file versions from the bucket, ensuring they cannot be recovered while the current version remains intact.

{% hint style="danger" %}
After xx days you set, S3 will delete all files created 60 days ago. It does not take into account the frequency of usage for these files.
{% endhint %}

<figure><img src="/files/aFtNpqi38FUVYDBbAOlz" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Step 4:** Click “Save” to apply the Rule to Bucket.

<figure><img src="/files/i8VmmYBhOTrw7cTUaR4E" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.higiocloud.vn/hi-gio-s3-storage/bucket-management/lifecycle-rule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
