--- title: "put-object-retention" slug: "put-object-retention" updated: 2026-10-08T05:00:33Z published: 2026-10-08T05:00:33Z canonical: "cli.ncloud-docs.com/put-object-retention" --- > ## Documentation Index > Fetch the complete documentation index at: https://cli.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # put-object-retention Available in Classic and VPC Apply retention settings to an Ncloud Storage object. Objects with retention settings cannot be deleted or modified until the specified expiration date. Note For a Sub Account user to execute this command, they must have the Change/PutObjectRetention action permission. ## Syntax The `put-object-retention` syntax is as follows: ``` aws s3api put-object-retention \ --bucket \ --key \ --retention \ [--version-id ] \ [--bypass-governance-retention | --no-bypass-governance-retention] \ [--content-md5 ] \ [--checksum-algorithm ] \ --endpoint-url ``` ## Options This section describes the options available when running `put-object-retention`. ### Required options The following options are required for `put-object-retention`. | Options | Type | Required | Description | | --- | --- | --- | --- | | `--bucket` | String | Required | Bucket name | | `--key` | String | Required | Object name | | `--retention` | String | Required | Object retention settings - Enter in JSON format. - `Mode`: `GOVERNANCE` \| `COMPLIANCE` - `RetainUntilDate`: Retention expiration date. ISO 8601 format; only future dates can be specified. - Entering an empty JSON (`{}`) removes retention. | ### Optional options These are the optional options for `put-object-retention`. Options that are not specified will use their default values. | Options | Type | Required | Description | | --- | --- | --- | --- | | `--version-id` | String | Optional | Object version ID | | `--bypass-governance-retention` | Boolean | Optional | Bypasses the `GOVERNANCE` mode retention settings. - Bypass permission is required. | | `--no-bypass-governance-retention` | Boolean | Optional | Does not bypass `GOVERNANCE` mode preservation settings. | | `--content-md5` | String | Optional | Base64-encoded 128-bit MD5 hash of the request data - Used to validate the integrity of the request data - Calculated automatically if not entered | | `--checksum-algorithm` | String | Optional | Checksum algorithm used to validate the request data - `CRC32` \| `CRC32C` \| `SHA1` \| `SHA256` \| `CRC64NVME` | ### Common options For information about the options common to all `aws` subcommands, see [Ncloud Storage options](/docs/en/storage-ncloudstorage#%EC%98%B5%EC%85%98). ## Examples If the request to save the settings is successful, the settings are applied, and no result is displayed. ### Command The command example is as follows: ``` aws s3api put-object-retention --bucket my-locked-bucket \ --key locked.txt \ --retention '{"Mode":"GOVERNANCE","RetainUntilDate":"2026-08-25T00:00:00Z"}' \ --endpoint-url=https://kr.ncloudstorage.com ``` ## Related commands Related commands are as follows: - [put-object-lock-configuration](/docs/en/put-object-lock-configuration) - [get-object-lock-configuration](/docs/en/get-object-lock-configuration) - [get-object-retention](/docs/en/get-object-retention) - [put-object-legal-hold](/docs/en/put-object-legal-hold) - [get-object-legal-hold](/docs/en/get-object-legal-hold)