PutBucketLifecycleConfiguration
Creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration. This is the newer version of the API that includes additional functionality, such as filter elements for more precise lifecycle rule application.
Description
The PutBucketLifecycleConfiguration
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.
- The maximum lifecycle configuration size is 20KB.
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 | Array of LifecyleRules |
For details about the elements within the Rule type, see Rule.
Examples
Example 1: Add lifecycle configuration with filters
This example adds a lifecycle configuration that uses filters to apply rules to objects based on size and tags.
Example 2: Add lifecycle configuration for versioned bucket
This example shows how to configure lifecycle rules for both current and noncurrent object versions.
Response Syntax
A successful operation returns 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 |
TooManyTags | The lifecycle configuration includes more than 10 tags in a single rule |
InvalidTag | The tag provided was not a valid tag. All tags must satisfy the tag restrictions |
Permissions
You must have the s3:PutLifecycleConfiguration
permission on the bucket.
Try It Out
Test PutBucketLifecycleConfiguration
Add or update the lifecycle configuration of a bucket with advanced filtering options.
Coming Soon
This feature is currently under development and will be available soon.