Skip to main content

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.

note
  • 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

PUT /?lifecycle HTTP/1.1
Host: BucketName.qstorage.quilibrium.com
Content-MD5: Base64EncodedMD5
x-amz-expected-bucket-owner: OwnerAccountId
<?xml version="1.0" encoding="UTF-8"?> <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Rule> <ID>string</ID> <Filter> <And> <Prefix>string</Prefix> <Tag> <Key>string</Key> <Value>string</Value> </Tag> <ObjectSizeGreaterThan>integer</ObjectSizeGreaterThan> <ObjectSizeLessThan>integer</ObjectSizeLessThan> </And> </Filter> <Status>string</Status> <Transition> <Days>integer</Days> <StorageClass>string</StorageClass> </Transition> <NoncurrentVersionTransition> <NoncurrentDays>integer</NoncurrentDays> <StorageClass>string</StorageClass> </NoncurrentVersionTransition> <Expiration> <Days>integer</Days> <ExpiredObjectDeleteMarker>boolean</ExpiredObjectDeleteMarker> </Expiration> <NoncurrentVersionExpiration> <NoncurrentDays>integer</NoncurrentDays> </NoncurrentVersionExpiration> <AbortIncompleteMultipartUpload> <DaysAfterInitiation>integer</DaysAfterInitiation> </AbortIncompleteMultipartUpload> </Rule> </LifecycleConfiguration>
Values in italics indicate user input and should be replaced with actual values.

Request Parameters

Headers

NameDescriptionRequiredType
Content-MD5The base64-encoded 128-bit MD5 digest of the lifecycle configuration XML. This header is required by the API specification but optional for QStorage.NoString
x-amz-expected-bucket-ownerThe 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).NoString
x-amz-sdk-checksum-algorithmIndicates 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
NoString

Request Elements

NameDescriptionRequiredType
LifecycleConfigurationContainer for lifecycle rules. You can add as many as 1,000 rules.YesContainer
RuleContainer for a lifecycle rule. You can add as many as 1,000 rules.YesArray 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.

PUT /?lifecycle HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
<?xml version="1.0" encoding="UTF-8"?> <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Rule> <ID>Rule for large log files</ID> <Filter> <And> <Prefix>logs/</Prefix> <Tag> <Key>type</Key> <Value>log</Value> </Tag> <ObjectSizeGreaterThan>5242880</ObjectSizeGreaterThan> </And> </Filter> <Status>Enabled</Status> <Transition> <Days>30</Days> <StorageClass>STANDARD_IA</StorageClass> </Transition> <Expiration> <Days>365</Days> </Expiration> </Rule> </LifecycleConfiguration>
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
x-amz-id-2: Example7qoYGN7uMuFuYS6m7a4l
x-amz-request-id: TX234S0F24A06C7
Date: Wed, 01 Mar 2024 12:00:00 GMT
Values in italics indicate variable response values.

Example 2: Add lifecycle configuration for versioned bucket

This example shows how to configure lifecycle rules for both current and noncurrent object versions.

PUT /?lifecycle HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
<?xml version="1.0" encoding="UTF-8"?> <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Rule> <ID>Version cleanup rule</ID> <Filter> <Prefix>documents/</Prefix> </Filter> <Status>Enabled</Status> <NoncurrentVersionTransition> <NoncurrentDays>30</NoncurrentDays> <StorageClass>STANDARD_IA</StorageClass> </NoncurrentVersionTransition> <NoncurrentVersionExpiration> <NoncurrentDays>365</NoncurrentDays> </NoncurrentVersionExpiration> </Rule> </LifecycleConfiguration>
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
x-amz-id-2: Example8qpZGN7uMuFuYS6m7b5k
x-amz-request-id: TX234S0F24A06C8
Date: Wed, 01 Mar 2024 12:00:00 GMT
Values in italics indicate variable response values.

Response Syntax

A successful operation returns HTTP status code 200 (OK) with an empty response body.

Response Headers

NameDescriptionRequiredType
x-amz-id-2An identifier for the requestNoString
x-amz-request-idA unique identifier for the requestNoString
DateThe date and time at which the response was sentNoString

Special Errors

Error CodeDescription
InvalidArgumentInvalid argument error
MalformedXMLThe XML provided was not well-formed or did not validate against the published schema
NoSuchBucketThe specified bucket does not exist
403Forbidden. Authentication failed or you do not have permission to create bucket lifecycle configuration
TooManyTagsThe lifecycle configuration includes more than 10 tags in a single rule
InvalidTagThe 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.