The latest service changes have not yet been reflected in this content. We will update the content as soon as possible. Please refer to the Korean version for information on the latest updates.
Available in Classic and VPC
Register a new lifecycle rule on an Ncloud Storage bucket or overwrite an existing lifecycle rule.
For a Sub Account user to execute this command, they must have the Change/PutLifecycleConfiguration action permission.
Syntax
The put-bucket-lifecycle-configuration syntax is as follows:
aws s3api put-bucket-lifecycle-configuration \
--bucket <bucket> \
--lifecycle-configuration <lifecycle-configuration> \
--endpoint-url <endpoint-url>
Options
This section describes the options available when running put-bucket-lifecycle-configuration.
Required options
The following options are required for put-bucket-lifecycle-configuration.
| Options | Type | Required | Description |
|---|---|---|---|
--bucket |
String | Required | Bucket name |
--lifecycle-configuration |
String | Required | Lifecycle rule
|
--lifecycle-configuration syntax
- Example 1: When bucket versioning is disabled
- According to the
Transitionrule, objects with thedocuments/prefix are transitioned to theDEEP_ARCHIVEstorage class after 180 days. - According to the
Expirationrule, objects with thelogs/prefix are deleted 360 days after creation.
- According to the
{
"Rules": [
{
"ID": "tran_documents",
"Filter": {
"Prefix": "documents/"
},
"Status": "Enabled",
"Transitions": [
{
"Days": 180,
"StorageClass": "DEEP_ARCHIVE"
}
]
},
{
"ID": "exp_logs",
"Filter": {
"Prefix": "logs/"
},
"Status": "Enabled",
"Expiration": {
"Days": 360
}
}
]
}
- Examples 2: When bucket versioning is enabled
- According to the
NoncurrentVersionTransitionrule, all object versions—except for the five most recent previous versions with thedocuments/prefix—are automatically transitioned to theDEEP_ARCHIVEstorage class 180 days after they become non-current. - According to the
NoncurrentVersionExpirationrule, objects with thelogs/prefix are deleted 100 days after they become non-current.
- According to the
{
"Rules": [
{
"ID": "tran_noncurrent_documents",
"Filter": {
"Prefix": "documents/"
},
"Status": "Enabled",
"NoncurrentVersionTransitions": [
{
"NewerNoncurrentVersions": 5,
"NoncurrentDays": 180,
"StorageClass": "DEEP_ARCHIVE"
}
]
},
{
"ID": "exp_noncurrent_logs",
"Filter": {
"Prefix": "logs/"
},
"Status": "Enabled",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 100
}
}
]
}
Common options
For information about the options common to all aws subcommands, see Ncloud Storage options.
Examples
If the request to register a lifecycle rule is successful, the rule is applied, and no result is displayed.
Command
The command example is as follows:
aws s3api put-bucket-lifecycle-configuration --bucket my-test-bucket \
--lifecycle-configuration file://lifecycle.json \
--endpoint-url=https://kr.ncloudstorage.com
Related commands
Related commands are as follows: