Lifecycle rules in Object Storage Service (OSS) cannot directly transition appendable objects to the Cold Archive or Deep Cold Archive storage class because they are writable. If you no longer need to append data to an appendable object, you can convert it to a normal object with the SealAppendObject operation. After the conversion, lifecycle rules can automatically transition the object to the Cold Archive or Deep Cold Archive storage class to reduce your long-term storage costs.
To use the SealAppendObject operation, submit a ticket for approval.
This topic provides an example of how to convert appendable objects to the Cold Archive storage class. In this example, the objects are in a bucket named examplebucket, have the prefix appendobjects/, and were last modified more than 30 days ago.
Step 1: List appendable objects
Filter and list all matching appendable objects to identify the objects to seal.
If versioning is not enabled for a bucket, each append operation updates the last modified time (Last-Modified) of an appendable object. If versioning is enabled or suspended for the bucket, the last modified time remains the same as its initial upload time and is not updated by subsequent appends. Therefore, if versioning is enabled or suspended for the bucket, this operation lists all appendable objects that were initially uploaded more than 30 days ago.
Ossutil
Run the following command to list all matching appendable objects. This example lists appendable objects that meet the following criteria: the last modified time is more than 30 days ago, the storage class is not Cold Archive or Deep Cold Archive, and the object is unsealed. Note the order of the filter conditions in the command.
ossutil ls oss://examplebucket/appendobjects/ -r -q --short-format --min-age=30d --metadata-exclude="x-oss-storage-class=*ColdArchive" --metadata-exclude="x-oss-sealed-time=*" --metadata-include="x-oss-object-type=Appendable"Sample response:
oss://examplebucket/appendobjects/unsealed_object1.txt
oss://examplebucket/appendobjects/unsealed_object2.txt
oss://examplebucket/appendobjects/unsealed_object3.txtAPI
Call the GetBucket (ListObjects) or ListObjectsV2 (GetBucketV2) API operation to iterate through all objects that have the specified prefix. Filter the results to find the target objects based on the following conditions:
The value of the
<Type>field isAppendable.The value of the
<StorageClass>field is notColdArchiveorDeepColdArchive.The value of the
<LastModified>field indicates a time more than 30 days ago.The response does not contain the
<SealedTime>field.
Step 2: Seal appendable objects
Perform the SealAppendObject operation to convert the appendable objects to normal objects so that lifecycle rules can transition them.
Ossutil
Get the object size: Run the
statcommand to get theContent-Lengthof the object. Use this value as thepositionparameter for the SealAppendObject operation.ossutil stat oss://examplebucket/appendobjects/unsealed_object1.txtPerform the SealAppendObject operation: Use the
invoke-operationcommand to call theSealAppendObjectAPI. Pass theContent-Lengthfrom the previous step, such as65536, as the value for thepositionparameter.ossutil api invoke-operation --op-name seal --method POST --bucket examplebucket --key appendobjects/unsealed_object1.txt --parameters seal --parameters position=65536
API
Get the object size: Get the
<Size>value of the target object from the response of the GetBucket (ListObjects) or ListObjectsV2 (GetBucketV2) API operation.Perform the SealAppendObject operation: For each target object, call the SealAppendObject API operation. Use the
<Size>value from the previous step as the value for thepositionparameter in the request. This converts the object to a non-appendable state.
Step 3: Configure a lifecycle rule
Configure a lifecycle rule to automatically transition objects to the Cold Archive or Deep Cold Archive storage class after a specified period.
Note: This rule applies to all normal objects, including objects uploaded with PutObject or multipart upload, and appendable objects that have been sealed. Ensure that the prefix in the rule is specific enough to avoid unintended object transitions.
Console
Log on to the OSS console.
Click Buckets, and then click examplebucket.
In the left-side navigation pane, choose .
Click Create Rule. Configure the lifecycle rule as described in the following table and keep the default values for the other parameters.
Area
Parameter
Configuration
Basic Settings
Status
Select Enabled.
Applied To
Select Object Prefix.
Prefix
Enter
appendobjects/.Policy for Current Versions
Object Lifecycle
Select Validity Period (Days).
Lifecycle-based Rules
Set a rule to transition objects to Cold Archive 30 days after their Modified Time.
Click OK.
Ossutil
Create a file named
lifecycle.xmland add the following content. This rule transitions objects that have theappendobjects/prefix and last modified more than 30 days ago to theColdArchivestorage class.<LifecycleConfiguration> <Rule> <ID>rule1</ID> <Prefix>appendobjects/</Prefix> <Status>Enabled</Status> <Transition> <Days>30</Days> <StorageClass>ColdArchive</StorageClass> </Transition> </Rule> </LifecycleConfiguration>Run the following command to apply the lifecycle rule to the
examplebucketbucket.ossutil api put-bucket-lifecycle --bucket examplebucket --lifecycle-configuration file://lifecycle.xml
API
Call the PutBucketLifecycle API operation and include the XML content in the request body to apply the rule to the target bucket examplebucket.
PUT /?lifecycle HTTP/1.1
Host: oss-examplebucket.oss.aliyuncs.com
Content-Length: 336
Date: Mon, 6 May 2025 15:23:20 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250506/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>rule1</ID>
<Prefix>appendobjects/</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>ColdArchive</StorageClass>
</Transition>
</Rule>
</LifecycleConfiguration>Verify the results
After you configure the lifecycle rule, it typically takes effect and runs for the first time early the next morning.
After the rule takes effect, you can check the storage class of the target objects to verify that they have transitioned to the Cold Archive storage class. You can check the storage class in the OSS console or by running the ossutil stat command.