Bucket object lifecycle configuration
Written by
Updated at March 19, 2025
Object Storage allows you to manage bucket object lifecycles. To upload a lifecycle configuration to Object Storage, you need to create an XML document as described in this section. You can get a document in this format by downloading an existing configuration.
The general configuration format is as follows:
<LifecycleConfiguration>
<Rule>
<ID>Rule description</ID>
<Status>{Enabled|Disabled}</Status>
<Filter>
<And>
<ObjectSizeGreaterThan>minimum object size</ObjectSizeGreaterThan>
<ObjectSizeLessThan>maximum object size</ObjectSizeLessThan>
<Prefix>key prefix</Prefix>
<Tag>
<Key>tag key</Key>
<Value>tag value</Value>
</Tag>
...
</And>
<ObjectSizeGreaterThan>minimum object size</ObjectSizeGreaterThan>
<ObjectSizeLessThan>maximum object size</ObjectSizeLessThan>
<Prefix>key prefix</Prefix>
<Tag>
<Key>tag key</Key>
<Value>tag value</Value>
</Tag>
</Filter>
<Transition>
<StorageClass>Storage class ID</StorageClass>
<!-- <Date> or <Days> -->
</Transition>
<Expiration>
<!-- <Date> or <Days> -->
<!-- <ExpiredObjectDeleteMarker> -->
</Expiration>
<NoncurrentVersionTransition>
<StorageClass>Storage class ID</StorageClass>
<NoncurrentDays>Migrating versions that are older than the specified number of days</NoncurrentDays>
</NoncurrentVersionTransition>
<NoncurrentVersionExpiration>
<NoncurrentDays>Deleting versions that are older than the specified number of days</NoncurrentDays>
</NoncurrentVersionExpiration>
<AbortIncompleteMultipartUpload>
<DaysAfterInitiation>Deleting uploads that were not completed within the specified number of days</DaysAfterInitiation>
</AbortIncompleteMultipartUpload>
...
</Rule>
<Rule>
...
</Rule>
...
</LifecycleConfiguration>
A configuration may contain up to 1,000 rules.
Elements
Element | Description |
---|---|
LifecycleConfiguration |
Root element of an XML document. It can contain up to 1,000 Rule elements.Path: LifecycleConfiguration . |
Rule |
Rule description. The Filter element specifies objects that meet the rule. The Transition and Expiration elements define actions on objects. There can be multiple actions of each type.Path: LifecycleConfiguration\Rule . |
ID |
Unique rule ID. Any text up to 255 characters long, e.g., Delete in 20 days. It is an optional parameter that you can use to search for a rule in a configuration. If the ID is not specified, Object Storage generates it automatically. Path: LifecycleConfiguration\Rule\ID . |
Status |
Rule status. You can activate a rule by setting <Status>Enabled</Status> or deactivate it by setting <Status>Disabled</Status> .Path: LifecycleConfiguration\Rule\Status . |
Filter |
Object filter. It may only contain one element of each type: And , Prefix , ObjectSizeGreaterThan , ObjectSizeLessThan , or Tag .If an empty <Filter></Filter> filter is set, the rule applies to all objects in a bucket.Path: LifecycleConfiguration\Rule\Filter . |
ObjectSizeGreaterThan |
Minimum object size in bytes. The rule applies to objects with a size greater than or equal to the specified value. The filter may contain only one minimum object size. Path: LifecycleConfiguration\Rule\Filter\ObjectSizeGreaterThan . |
ObjectSizeLessThan |
Maximum object size in bytes. The rule applies to objects with a size less than or equal to the specified value. The filter may contain only one maximum object size. Path: LifecycleConfiguration\Rule\Filter\ObjectSizeLessThan . |
Prefix |
Key prefix. The rule applies to objects with the specified key prefix. For example, the some/long/object/key key may have these prefixes: some , some/ , or some/lo .The filter may contain only one prefix. Path: LifecycleConfiguration\Rule\Filter\Prefix . |
Tag |
Object label. The rule applies to objects with the specified label assigned. The filter may contain only one object label. Path: LifecycleConfiguration\Rule\Filter\Tag . |
And |
Logical AND for filters.This filter may contain any combination of the following elements: Prefix , ObjectSizeGreaterThan , ObjectSizeLessThan , and Tag .Path: LifecycleConfiguration\Rule\Filter\And . |
Key |
Object label key. Path: LifecycleConfiguration\Rule\Filter\Tag\Key . |
Value |
Object label value. Path: LifecycleConfiguration\Rule\Filter\Tag\Value . |
Transition |
Rule for changing the storage class of an object. It contains the StorageClass element, which defines the target storage class and the Date or Days element, which sets when the action expires.You can only move objects from the STANDARD storage to the COLD or ICE one, and from the cold storage, to the ice one.Path: LifecycleConfiguration\Rule\Transition\ . |
StorageClass |
Storage class of an object. Path: LifecycleConfiguration\Rule\Transition\StorageClass . |
Expiration |
Rule for deleting an object from Object Storage. It contains the Days or Date element, which sets when the action expires.It may also contain ExpiredObjectDeleteMarker : an expired object delete marker that indicates whether Object Storage will remove the delete marker if there are not any non-current versions.Path: LifecycleConfiguration\Rule\Expiration . |
Date |
Date for the rule to apply. The date should be in ISO 8601 YYYY-MM-DD . The time is always 00:00 UTC.Path: LifecycleConfiguration\Rule\Expiration\Date . |
Days |
Time interval for the rule to apply. It is defined by the number of days since the object was uploaded. The minimum value is 1 .Path: LifecycleConfiguration\Rule\Expiration\Days . |
NoncurrentVersionTransition |
Rule for changing the storage class of non-current object versions. This rule only applies to non-current versions of an object rather than the entire object. It contains the StorageClass element, which defines the target storage class and the NoncurrentDays element, which sets when the action expires.You can only move objects from the STANDARD storage to the COLD or ICE one, and from the cold storage, to the ice one.Path: LifecycleConfiguration\Rule\NoncurrentVersionTransition . |
NoncurrentVersionExpiration |
Rule for deleting non-current object versions from Object Storage. This rule only applies to non-current versions of an object rather than the entire object. It contains the NoncurrentDays element, which sets when the action expires.Path: LifecycleConfiguration\Rule\NoncurrentVersionExpiration . |
AbortIncompleteMultipartUpload |
Rule for deleting uploads that were not completed within the specified number of days. It contains the DaysAfterInitiation element, which sets when the rule is to be applied.Path: LifecycleConfiguration\Rule\AbortIncompleteMultipartUpload\ . |
Example
The rule below applies to all objects uploaded to the bucket as follows:
- They are moved to the cold storage 30 days after being uploaded to Object Storage.
- They are deleted from Object Storage 365 days after being uploaded.
- Incomplete uploads are deleted from Object Storage five days after the start of the object upload.
<LifecycleConfiguration>
<Rule>
<ID>Move and then delete</ID>
<Status>Enabled</Status>
<Filter>
<Prefix></Prefix>
</Filter>
<Transition>
<StorageClass>COLD</StorageClass>
<Days>30</Days>
</Transition>
<Expiration>
<Days>365</Days>
</Expiration>
<AbortIncompleteMultipartUpload>
<DaysAfterInitiation>5</DaysAfterInitiation>
</AbortIncompleteMultipartUpload>
</Rule>
</LifecycleConfiguration>