Bucket object lifecycle configuration
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>
<NewerNoncurrentVersions>Number of recent non-current versions that are stored indefinitely</NewerNoncurrentVersions>
</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 |
|
|
Root element of an XML document. |
|
|
Rule description. |
|
|
Unique rule ID. |
|
|
Rule status. |
|
|
Object filter. |
|
|
Minimum object size in bytes. |
|
|
Maximum object size in bytes. |
|
|
Key prefix. |
|
|
Object label. |
|
|
Logical |
|
|
Object label key. |
|
|
Object label value. |
|
|
Rule for changing the storage class of an object. |
|
|
Storage class of the object It can be |
|
|
Rule for deleting an object from Object Storage. |
|
|
Date for the rule to apply. |
|
|
Time interval for the rule to apply. |
|
|
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. |
|
|
Storage class to move the object to. It can be |
|
|
Number of days after which a non-current version is moved to a different storage class. The minimum value is |
|
|
Number of recent non-current object versions retained indefinitely. Versions beyond this number are migrated to another storage class after the period specified in |
|
|
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. Tip To remove non-current delete markers, use the |
|
|
Number of days after which a non-current version will be deleted. The minimum value is |
|
|
Number of recent non-current object versions retained indefinitely. Versions beyond this number get deleted after the period specified in |
|
|
Rule for deleting uploads that were not completed within the specified number of days. |
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>
Related articles
Useful links
The non-current object version that has been deleted gets marked by a non-current delete marker (NoncurrentDeleteMarker). This happens when a new object version is loaded on top of a deleted one. In which case the object becomes available again, and the marker which used to mark the deleted version moves to the version history.