put-object-lock-configuration

Prev Next

Available in Classic and VPC

Apply object lock settings on an Ncloud Storage bucket. Using object lock prevents objects from being deleted or modified for a specified period of time.

Note

For a Sub Account user to execute this command, they must have the Change/PutBucketObjectLockConfiguration action permission.

Syntax

The put-object-lock-configuration syntax is as follows:

aws s3api put-object-lock-configuration \
    --bucket <bucket> \
    --object-lock-configuration <object-lock-configuration> \
    [--content-md5 <content-md5>] \
    [--checksum-algorithm <checksum-algorithm>] \
    --endpoint-url <endpoint-url>

Options

This section describes the options available when running put-object-lock-configuration.

Required options

The following options are required for put-object-lock-configuration.

Options Type Required Description
--bucket String Required Bucket name
--object-lock-configuration String Required Object lock settings
  • Enter in JSON format.
    • ObjectLockEnabled (required): Whether object lock is enabled. Enabled
    • Rule.DefaultRetention.Mode (required): Object retention mode. GOVERNANCE (can be bypassed with special permissions) | COMPLIANCE (can't be bypassed by anyone)
    • Rule.DefaultRetention.Days (conditional): Retention period (days). 1~36500. Rule.DefaultRetention.Days or Rule.DefaultRetention.Years must be entered.
    • Rule.DefaultRetention.Years (conditional): Retention period (years). 1-100. Rule.DefaultRetention.Years or Rule.DefaultRetention.Days must be entered.

Optional options

These are the optional options for put-object-lock-configuration. Options that are not specified will use their default values.

Options Type Required Description
--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.

Examples

If the object lock configuration request is successful, the settings are applied, and no result is displayed.

Command

The command example is as follows:

aws s3api put-object-lock-configuration --bucket my-locked-bucket \
    --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":1}}}' \
    --endpoint-url=https://kr.ncloudstorage.com

Related commands

Related commands are as follows: