# Enabling object lock

Object lock can prevent objects from being removed or overwritten for a specified period. Note that you must first enable versioning before enabling this feature on a bucket. Unlike versioning, object lock must be enabled at the time of bucket creation and the settings cannot be changed after creation.

You can either choose to define a retention period for each object individually or for all underlying objects. Legal holds can only be defined by version or object and not by bucket.

* **Reserve the option for individual retention periods** for underlying objects by leaving the 'Retention' checkmark blank.

<figure><img src="https://2387956678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY8faE22vrUUDUtw9aDVb%2Fuploads%2F08Y7fN0jMdk6I2fEp2gz%2Fimage.png?alt=media&#x26;token=17435bda-b6bf-4d18-8d8a-a2c501999885" alt=""><figcaption></figcaption></figure>

* **Set up aggregate retention periods** for all underlying objects by defining the retention mode and validity when creating the bucket.

<figure><img src="https://2387956678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY8faE22vrUUDUtw9aDVb%2Fuploads%2FIiVYcmsz2e7xF8WwFkAg%2Fimage.png?alt=media&#x26;token=88cd17aa-874c-409b-9662-dee54510750c" alt=""><figcaption></figcaption></figure>


---

# 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.impossiblecloud.com/impossible-cloud-help/impossible-cloud-storage-guide/buckets-and-objects/versioning-and-object-lock/enabling-object-lock.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.
