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.
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 <bucket> \
--key <key> \
--retention <retention> \
[--version-id <version-id>] \
[--bypass-governance-retention | --no-bypass-governance-retention] \
[--content-md5 <content-md5>] \
[--checksum-algorithm <checksum-algorithm>] \
--endpoint-url <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
|
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.
|
--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
|
--checksum-algorithm |
String | Optional | Checksum algorithm used to validate the request data
|
Common options
For information about the options common to all aws subcommands, see Ncloud Storage options.
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: