- Print
- DarkLight
S3 Put Lifecycle Configuration
- Print
- DarkLight
PUThttps://s3.<your-region>.backblazeb2.com/<your-bucket-name>?lifecycle
Creates a new lifecycle configuration for a bucket or replaces an existing lifecycle configuration. This operation will overwrite an existing lifecycle configuration, so if you want to retain any configuration details, they must be included in the new lifecycle configuration. For information about lifecycle configuration, see Lifecycle Rules.
AUTHORIZATION AWS Signature
This request is using AWS Signature from collection Backblaze B2 Cloud Storage S3 Compatible API.
URI REQUEST PARAMETERS
Bucket | Required. The name of the bucket for which to set the lifecycle configuration. The bucket must have versioning enabled. |
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). |
x-amz-sdk-checksum-algorithm | Indicates the algorithm used to create the checksum for the request when you use the SDK. When you send this header, there must be a corresponding x-amz-checksum or x-amz-trailer header sent. Otherwise, the request fails with the HTTP status code 400 Bad Request. Valid Values: CRC32 | CRC32C | SHA1 | SHA256 | CRC64NVME |
REQUEST BODY
LifecycleConfiguration | Required. Root level tag for the LifecycleConfiguration parameters. |
Rule | Required. A lifecycle rule for individual objects in the bucket. An S3 Lifecycle configuration can have up to 1,000 rules. |
B2 COMPATIBILITY NOTES
S3 lifecycle rules are mapped to Backblaze B2 lifecycle rules as follows:
S3 Lifecycle Action | B2 Lifecycle Action |
Expiration | hide |
NoncurrentVersionExpiration | delete |
AbortIncompleteMultipartUpload | daysFromStartingToCancelingUnfinishedLargeFiles |
Supported Features
The following S3 lifecycle rule features are supported:
ExpirationwithDays- Hide the current version of objects after a specified number of days.ExpirationwithExpiredObjectDeleteMarkerset totrue- Remove orphan delete markers.NoncurrentVersionExpirationwithNoncurrentDays- Permanently delete noncurrent object versions after a specified number of days.AbortIncompleteMultipartUploadwithDaysAfterInitiation- Abort incomplete multipart uploads after a specified number of days.FilterwithPrefix- Apply rules to objects matching a key name prefix.ID- Optional identifier for the rule.Statusset toEnabled- Rules must be enabled.
Unsupported Features
The following S3 lifecycle rule features are not supported and will return a 400 Bad Request error:
TransitionandNoncurrentVersionTransition- Storage class transitions are not supported.ExpirationwithDate- Date-based expiration is not supported. UseDaysinstead.ExpiredObjectDeleteMarkerset tofalse- B2 always removes orphan delete markers.NewerNoncurrentVersions- Keeping a specific number of noncurrent versions is not supported.Statusset toDisabled- Disabled rules are not supported.Filter sub-elements other than
Prefix- Tag-based filtering (Tag), object size filtering (ObjectSizeGreaterThan,ObjectSizeLessThan), andAndcombinations are not supported.Overlapping prefix filters - Rules with overlapping prefixes are not supported.
Top-level
Prefix(deprecated) - UseFilterwithPrefixinstead.Unversioned or versioning-suspended buckets - Only versioning-enabled buckets are supported.
Expiration Rule Pairing Requirement
B2 lifecycle rules always remove orphan delete markers (delete markers with no remaining object versions). Because of this behavior, S3 Expiration rules must be defined in pairs for each prefix:
One rule with
Expirationspecifying the number ofDaysto wait before hiding the current version.One rule with the same prefix that includes
ExpirationwithExpiredObjectDeleteMarkerset totrue.
These two S3 rules are stored as a single corresponding B2 lifecycle rule.
Example Request
Request Body
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>expire-logs-after-30-days</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Expiration>
<Days>30</Days>
</Expiration>
</Rule>
<Rule>
<ID>expire-logs-delete-markers</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Expiration>
<ExpiredObjectDeleteMarker>true</ExpiredObjectDeleteMarker>
</Expiration>
</Rule>
<Rule>
<ID>delete-old-versions-after-90-days</ID>
<Filter>
<Prefix>documents/</Prefix>
</Filter>
<Status>Enabled</Status>
<NoncurrentVersionExpiration>
<NoncurrentDays>90</NoncurrentDays>
</NoncurrentVersionExpiration>
</Rule>
<Rule>
<ID>abort-incomplete-uploads</ID>
<Filter>
<Prefix></Prefix>
</Filter>
<Status>Enabled</Status>
<AbortIncompleteMultipartUpload>
<DaysAfterInitiation>7</DaysAfterInitiation>
</AbortIncompleteMultipartUpload>
</Rule>
</LifecycleConfiguration>Example Response
200 OK
HTTP/1.1 200 OK
x-amz-id-2: r+qR7+nhXtJDDIJ0JJYcd+1j5nM/rUFiiiZ/fNbDOsd3JUE8NWMLNHXmvPfwMpdc
x-amz-request-id: 9E26D08072A8EF9E
Date: Wed, 14 May 2014 02:11:22 GMT
Content-Length: 0
Server: AmazonS3400 Bad Request
HTTP/1.1 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>NotSupported</Code>
<Message>The specified lifecycle configuration feature is not supported.</Message>
</Error>