PutBucketLifecycle
For an updated version of this API, see PutBucketLifecycleConfiguration. If you want to use the filter
element to specify lifecycle rule filters, you must use the updated API. This topic is provided for backward compatibility.
Creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration.
Description
The PutBucketLifecycle
operation creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration. To use this operation, you must have permission to perform the s3:PutLifecycleConfiguration
action.
By default, all QStorage objects are persistently stored; however, you can use object lifecycle configuration to manage objects so they are automatically transitioned to different storage classes or expired.
- If you specify a lifecycle configuration that includes a rule with an
AbortIncompleteMultipartUpload
action, the action applies only to multipart uploads that are initiated after the lifecycle configuration is set. - This operation is not supported for directory buckets.
Request Syntax
Request Parameters
Headers
Name | Description | Required | Type |
---|---|---|---|
Content-MD5 | The base64-encoded 128-bit MD5 digest of the lifecycle configuration XML. This header is required by the API specification but optional for QStorage. | No | String |
x-amz-expected-bucket-owner | The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied). | No | String |
x-amz-sdk-checksum-algorithm | Indicates the algorithm used to create the checksum for the request when using the SDK. Must be accompanied by either x-amz-checksum or x-amz-trailer header. If an individual checksum is provided, this parameter is ignored. Valid values: CRC32 | CRC32C | SHA1 | SHA256 | CRC64NVME | No | String |
Request Elements
Name | Description | Required | Type |
---|---|---|---|
LifecycleConfiguration | Container for lifecycle rules. You can add as many as 1,000 rules. | Yes | Container |
Rule | Container for a lifecycle rule. You can add as many as 1,000 rules. | Yes | Rule |
For details about the elements within the Rule type, see Rule.
Examples
Example 1: Add lifecycle configuration - archive and then delete
This example adds a lifecycle configuration to a bucket. The configuration specifies that objects with the prefix projectdocs/
will transition to the STANDARD_IA storage class after 30 days, then to GLACIER after 365 days, and finally be deleted after 3650 days.
Response Syntax
A successful operation returns either HTTP status code 200 (OK) with an empty response body.
Response Headers
Name | Description | Required | Type |
---|---|---|---|
x-amz-id-2 | An identifier for the request | No | String |
x-amz-request-id | A unique identifier for the request | No | String |
Date | The date and time at which the response was sent | No | String |
Special Errors
Error Code | Description |
---|---|
InvalidArgument | Invalid argument error |
MalformedXML | The XML provided was not well-formed or did not validate against the published schema |
NoSuchBucket | The specified bucket does not exist |
403 | Forbidden. Authentication failed or you do not have permission to create bucket lifecycle configuration |
Permissions
You must have the s3:PutLifecycleConfiguration
permission on the bucket.
Try It Out
Test PutBucketLifecycle
Add or update the lifecycle configuration of a bucket.
Coming Soon
This feature is currently under development and will be available soon.