Skip to main content

PutBucketLifecycle

Deprecated

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.

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.

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> <Prefix>string</Prefix> <Status>string</Status> <Transition> <Days>integer</Days> <StorageClass>string</StorageClass> </Transition> <Expiration> <Days>integer</Days> </Expiration> <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.YesRule

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.

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>Archive and then delete rule</ID> <Prefix>projectdocs/</Prefix> <Status>Enabled</Status> <Transition> <Days>30</Days> <StorageClass>STANDARD_IA</StorageClass> </Transition> <Transition> <Days>365</Days> <StorageClass>GLACIER</StorageClass> </Transition> <Expiration> <Days>3650</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.

Response Syntax

A successful operation returns either 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

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.