Bucket object lifecycle configuration
Written by
Updated at May 5, 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>label key</Key>
<Value>label value</Value>
</Tag>
...
</And>
<ObjectSizeGreaterThan>minimum object size</ObjectSizeGreaterThan>
<ObjectSizeLessThan>maximum object size</ObjectSizeLessThan>
<Prefix>key prefix</Prefix>
<Tag>
<Key>label key</Key>
<Value>label 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 the XML document. It may contain up to 1,000 Rule elements.Path: LifecycleConfiguration . |
Rule |
Rule description. Objects covered by the rule are set using the Filter element. 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". An optional parameter that you can use to search for a rule in a configuration. If no ID is specified, Object Storage generates one 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. Contains no more than one element of each type: And , Prefix , ObjectSizeGreaterThan , ObjectSizeLessThan , Tag .If you set an empty filter named ( <Filter></Filter> ), the rule will apply to all objects in the bucket.Path: LifecycleConfiguration\Rule\Filter . |
ObjectSizeGreaterThan |
Minimum object size in bytes. The rule applies to objects whose size is greater than or equal to the specified one. A filter may only contain one minimum object size. Path: LifecycleConfiguration\Rule\Filter\ObjectSizeGreaterThan . |
ObjectSizeLessThan |
Maximum object size in bytes. The rule applies to objects whose size is smaller than or equal to the specified one. A filter may only contain one maximum object size. Path: LifecycleConfiguration\Rule\Filter\ObjectSizeLessThan . |
Prefix |
Key prefix. The rule applies to objects with the specified key prefix. Examples of prefixes for a key named some/long/object/key : some , some/ , and some/lo .A filter may only contain one prefix. Path: LifecycleConfiguration\Rule\Filter\Prefix . |
Tag |
Object tag. The rule applies to objects the specified tag is assigned to. The filter may contain only one object tag. Path: LifecycleConfiguration\Rule\Filter\Tag . |
And |
AND logical operator for filters.May contain any combination of the following elements: Prefix , ObjectSizeGreaterThan , ObjectSizeLessThan , Tag .Path: LifecycleConfiguration\Rule\Filter\And . |
Key |
Object tag key. Path: LifecycleConfiguration\Rule\Filter\Tag\Key . |
Value |
Object tag value. Path: LifecycleConfiguration\Rule\Filter\Tag\Value . |
Transition |
Rule for changing object storage class. Contains the StorageClass element that defines the target storage class and the Date or Days element for when the action will be executed.You can move objects from STANDARD to COLD or ICE storage and from COLD to ICE storage.For buckets with versioning enabled, the action will be applied to the current object versions. Path: LifecycleConfiguration\Rule\Transition\ . |
StorageClass |
Object storage class. Path: LifecycleConfiguration\Rule\Transition\StorageClass . |
Expiration |
Rule for deleting an object from Object Storage. Contains the Days or Date element representing the action execution date.It may also contain ExpiredObjectDeleteMarker , which is the expired object delete marker that indicates whether Object Storage will remove the delete marker if there are no non-current versions.For buckets with versioning enabled, the action will be applied to the current object versions. Path: LifecycleConfiguration\Rule\Expiration . |
Date |
Rule execution date. Format: ISO 8601 YYYY-MM-DD . The time is always 00:00 UTC.Path: LifecycleConfiguration\Rule\Expiration\Date . |
Days |
Rule execution interval. Defined by the number of days since the object's upload. Minimum value: 1. Path: LifecycleConfiguration\Rule\Expiration\Days . |
NoncurrentVersionTransition |
Rule for changing the storage class of non-current object versions. This rule applies only to non-current versions of the object rather than the whole object. It contains the StorageClass element that defines the target storage class and the NoncurrentDays element that defines the action execution date.You can move objects from STANDARD to COLD or ICE storage and from COLD to ICE storage.Path: LifecycleConfiguration\Rule\NoncurrentVersionTransition . |
NoncurrentVersionExpiration |
Rule for deleting non-current object versions from Object Storage. This rule applies only to non-current versions of the object rather than the whole object. Contains the NoncurrentDays element that defines the action execution date.Path: LifecycleConfiguration\Rule\NoncurrentVersionExpiration . |
AbortIncompleteMultipartUpload |
Rule for deleting uploads not completed within the specified number of days. Contains the DaysAfterInitiation element which sets the rule execution time.Path: LifecycleConfiguration\Rule\AbortIncompleteMultipartUpload\ DaysAfterInitiation . |
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>