Lifecycle Configuration Elements
The following uses an example to describe the elements of a lifecycle rule.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<LifecycleConfiguration> <!-- First rule --> <Rule> <ID>Rule-1</ID> <Prefix>prefix1</Prefix> <Status>Enabled</Status> <!-- Delete the current version of an object whose last modification time was before May 20, 2023 and prefix is prefix1/. --> <Expiration> <Date>2023-05-20T00:00:00.000Z</Date> </Expiration> </Rule> <!-- Second rule --> <Rule> <ID>Rule-2</ID> <Filter> <Prefix>prefix2</Prefix> <Tag> <Key>key1</Key> <Value>value1</Value> </Tag> </Filter> <Status>Enabled</Status> <!-- Transition the current version of an object whose prefix is prefix2/, tag is key1/value1, and last modification time is 30 days ago, to the Archive storage class. --> <Transition> <Days>30</Days> <StorageClass>COLD</StorageClass> </Transition> <!-- Delete the current version of an object whose prefix is prefix2/, tag is key1/value1, and last modification time is 60 days ago. --> <Expiration> <Days>60</Days> </Expiration> <!-- Transition the historical version of an object whose prefix is prefix2/, tag is key1/value1, and last modification time is 30 days ago, to the Archive storage class. --> <NoncurrentVersionTransition> <NoncurrentDays>30</NoncurrentDays> <StorageClass>COLD</StorageClass> </NoncurrentVersionTransition> <!-- Delete the historical version of an object whose prefix is prefix2/, tag is key1/value1, and last modification time is 60 days ago. --> <NoncurrentVersionExpiration> <NoncurrentDays>60</NoncurrentDays> </NoncurrentVersionExpiration> </Rule> </LifecycleConfiguration> |
Elements of a lifecycle rule
A complete lifecycle rule consists of a range of elements that fall into metadata, filters, and actions (execution time included).

Metadata
Rule metadata describes the rule ID and rule status.
Element |
Description |
|
---|---|---|
Metadata |
ID |
Definition: Rule ID, which uniquely identifies a rule. Value range: The value is a string ranging from 0 (exclusive) to 255 characters. It can contain only uppercase or lowercase letters, digits, periods (.), underscores (_), and hyphens (-). Default value: If the ID element is not used or is left blank, OBS automatically assigns a unique ID to the rule. |
Status |
Definition: It indicates whether the rule is enabled or disabled. If the rule is disabled, OBS does not perform any actions defined in the rule. Value range:
Default value: N/A |
Filters
The object filter criteria of a rule describe the objects to which a lifecycle rule is applied.
Element |
Description |
|||
---|---|---|---|---|
Filters |
Prefix |
Definition: Object name prefix, which identifies the objects to which the lifecycle rule applies If you leave the Prefix element blank, the rule applies to all objects in the bucket. Constraints:
Value range: The value is a string ranging from 0 to 1024 characters. Default value: If this element is not specified, it is left blank by default. |
||
Tag |
Definition: Object tag, which identifies the objects to which the lifecycle rule applies. Constraints:
In the example below, objects with the key1/value1 tag will be deleted 120 days after the last update.
Default value: If this element is not specified, it is left blank by default. |
|||
Combination of Prefix and Tag |
You can filter objects by a combination of prefix and object tags. In this case, you need to use a logical And to combine the filters. A logical And must contain at least two filter conditions. Prefix is mandatory and only one prefix can be configured. Tag is optional and up to 10 tags can be configured. In the example below, objects with the key1/value1 tag and the texta/ prefix will be deleted 120 days after the last modification.
|
Actions
The following table describes actions that will be performed on objects and when the actions will be performed.
Element |
Description |
Sub-elements |
Description |
---|---|---|---|
Expiration |
Used to delete objects
NOTE:
The Expiration action does not delete unassembled multipart uploads. |
Days (Use only one of the Days, Date, and ExpiredObjectDeleteMarker elements.) |
Definition: The number of days since the last object update, after which eligible objects will be expired and then deleted Constraints:
Value range: A positive integer, in days Default value: N/A |
Date (Use only one of the Days, Date, and ExpiredObjectDeleteMarker elements.) |
Definition: The date, before which objects were last modified will be expired and then deleted Constraints:
Default value: N/A |
||
Used to remove expired delete markers |
ExpiredObjectDeleteMarker (Use only one of the Days, Date, and ExpiredObjectDeleteMarker elements.) |
Definition: Whether to remove expired delete markers Constraints: Object tags cannot be used as filters. Value range:
Default value: N/A |
|
Transition |
Used to transition objects between storage classes |
Days (Use either Days or Date.) |
Definition: The number of days since the last object update, after which eligible objects will be transitioned to another storage class Constraints: Days applies only to the current version of an object. Value range: Unit: day
Default value: N/A |
Date (Use either Days or Date.) |
Definition: The date, before which objects were last modified will be transitioned to another storage class Constraints:
Default value: N/A |
||
StorageClass |
Definition: New storage class eligible objects will be transitioned to Value range:
Default value: N/A |
||
AbortIncompleteMultipartUpload |
Used to delete fragments |
DaysAfterInitiation |
Definition: The number of days since fragment generation, after which fragments will be expired and then deleted Constraints: Object tags cannot be used as filters. Value range: A positive integer, in days Default value: N/A |
NoncurrentVersionExpiration |
Used to delete historical object versions |
NoncurrentDays |
Definition: The number of days since the objects became noncurrent, after which noncurrent object versions will be deleted Constraints:
Value range: A positive integer, in days Default value: N/A |
NoncurrentVersionTransition |
Used to transition noncurrent versions |
NoncurrentDays |
Definition: The number of days since the objects became noncurrent, after which noncurrent object versions will be transitioned to another storage class Constraints:
Value range: Unit: day
Default value: N/A |
StorageClass |
Definition: New storage class eligible historical object versions will be transitioned to Value range:
Default value: N/A |

In the same lifecycle rule, Days or Date must be consistently used. If you use Days for Expiration, you must also use Days (rather than Date) for Transition, and vice versa.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot