put-bucket-lifecycle-configuration

Prev Next

Available in Classic and VPC

Register a new lifecycle rule on an Ncloud Storage bucket or overwrite an existing lifecycle rule. You can only register lifecycle rules on buckets that have been enabled.
Note

To ensure stable operation, object deletion tasks (delete current version, delete previous version, delete expired deletion marker) have been temporarily disabled. The expiration task of existing rules will not be performed. We will inform you again when the feature is resumed.

Commands

The command statement is as follows:

aws s3api put-bucket-lifecycle-configuration --bucket <value> --lifecycle-configuration file://lifecycle.json [--options]

Parameter

The following describes the parameters.

Parameter Type Required Description Restrictions
--bucket <value> string Y Bucket name -
--lifecycle-configuration <value> string Y Lifecycle rule Syntax
--endpoint-url <value> string N Specify the default URL for command calls. It is only available for the KR Region. See Ncloud Storage overview for call domain information.
--cli-input-json | --cli-input-yaml string N Enter arguments from the provided json or yaml string. You can't specify json and yaml together.
--generate-cli-skeleton <value> integer N Create a parameter template that can be used as input later without executing the API command. -
--debug boolean N Use debug logging. -
--no-verify-ssl boolean N Redefine the default behavior for validating SSL certificates. -
--no-paginate boolean N Disable automatic pagination, call only the first page for results. -
--output <value> string N Specify the format of response results. Available options
  • json
  • text
  • table
  • yaml
  • yaml-stream
--query <value> string N JMESPath query to use for filtering response data -
--profile <value> string N Use a specific profile in the credentials file. -
--region <value> string N Specify the Region. Only KR is supported.
--color <value> string N Set output color. Available options
  • on
  • off
  • auto
--no-sign-request boolean N Disable credential loading. -
--ca-bundle <value> string N Specify the CA certificate to use when verifying SSL certificates. -
--cli-read-timeout <value> int N Maximum read time; entering 0 changes it to a blocked status instead of a timeout. It is set to 60 seconds by default.
--cli-connect-timeout <value> int N Maximum connection time; entering 0 changes it to a blocked status instead of a timeout. It is set to 60 seconds by default.
--no-cli-pager boolean N Disable the CLI pager for response values. -
--cli-auto-prompt boolean N Enable automatic prompting for CLI input parameters. -
--no-cli-auto-prompt boolean N Disable automatic prompting for CLI input parameters. -

--lifecycle-configuration Syntax

Note

The Date field is not supported.

  • Json Syntax 1: When bucket versioning is not enabled
    According to the Transitions rule, objects with the "logs/" prefix will be transitioned to the DEEP_ARCHIVE storage class after 180 days.
{
   "Rules":[
      {
         "ID":"id1",
         "Status":"Enabled",
         "Filter":{
            "Prefix":"logs/"
         },
         "Transitions":[
            {
               "Days":180,
               "StorageClass":"DEEP_ARCHIVE"
            }
         ]
      }
   ]
}
  • Json Syntax 2: When bucket versioning is enabled
    According to the NoncurrentVersionTransitions rule, all object versions except the five most recent versions with the "logs/" prefix will automatically transition to the DEEP_ARCHIVE storage class 180 days after becoming noncurrent.
{
   "Rules":[
      {
         "ID":"id2",
         "Status":"Enabled",
         "Filter":{
            "Prefix":"logs/"
         },
         "NoncurrentVersionTransitions":[
            {
               "NoncurrentDays":180,
               "NewerNoncurrentVersions":5,
               "StorageClass":"DEEP_ARCHIVE"
            }
         ]
      }
   ]
}

Permissions

If a sub account user wants to use this command, they need the Change/PutLifecycleConfiguration action permission.

Examples

This section describes an example of calling and responding to the put-bucket-lifecycle-configuration command.

Set lifecycle

Call examples

Specify a bucket name to call the command, and the lifecycle rule will be saved.

aws s3api put-bucket-lifecycle-configuration --endpoint-url=http://kr.ncloudstorage.com --bucket test1 --lifecycle-configuration file://lifecycle.json

Related commands

Related commands are as follows: