--- title: "Add a lifecycle rule" description: "Add a lifecycle rule to a TIR Object Storage bucket that deletes objects automatically after 1 to 365 days, for all objects or for a prefix." content_type: "how-to" product: "tir-object-storage" platform: "TIR" url: "/tir/tir-object-storage/how-to/add-a-lifecycle-rule/" topic: ["protect-and-manage"] --- # Add a lifecycle rule A lifecycle rule deletes objects automatically after a number of days, so temporary data clears itself out. ## Before you begin - A bucket that TIR created, in the **Ready** state. Lifecycle rules work only on buckets TIR created. - Permission to update datasets in the project. A Member gets it through a policy that allows updating datasets. - A decision on the days. A lifecycle rule deletes objects permanently. It leaves governance-locked versions in place until their retention ends. ## Add the rule 1. In the list, select the bucket's row and open the **Bucket Lifecycle** tab. It lists rules with **Applied to**, **Prefix**, **Expiration Days**, **Created On**, and **Actions**. 2. Select **Configure Lifecycle Rule**. 3. In **Apply To**, choose **All Objects** to apply the rule to every object in the dataset. Choose **Objects with Prefix** to apply it only to objects whose names start with a prefix. 4. For **Objects with Prefix**, type the prefix, such as `logs/`, `temp/`, or `archive/`. Each prefix can have one rule. If you add a second rule for the same prefix, the form says "Prefix already applied in existing rules". 5. Enter **Expiration Days**, the number of days before TIR deletes the objects, from 1 to 365. Above that, the form says "Expiration days cannot exceed 365". 6. Save the rule. The portal shows "Lifecycle rule created successfully". A bucket can have several rules, so you can use different prefixes to keep different data for different lengths of time. ## Delete a rule To change a saved rule, delete it and add a new one. Open the rule's **Actions** menu, select **Delete lifecycle policy**, and confirm in **Delete Lifecycle Rule**, which names the prefix the rule applies to, or says that it applies to the whole bucket. The portal shows "Lifecycle rule deleted successfully". ## Check the rule The rule is listed under **Bucket Lifecycle** with its prefix and **Expiration Days**. You can manage rules only while the bucket is **Ready**. TIR now deletes the objects under the rule once they are older than the rule's **Expiration Days**. To control the versions of a versioned bucket, see [Use object versioning](/tir/tir-object-storage/how-to/use-object-versioning/). For help with a message, see [Troubleshooting TIR Object Storage](/tir/tir-object-storage/troubleshooting/tir-object-storage/).