OSS lifecycle rules cannot directly transition appendable objects to the Cold Archive or Deep Cold Archive storage class — appendable objects remain in a writable state, which blocks lifecycle transitions. To work around this, use the SealAppendObject operation to convert appendable objects to normal objects first, then configure a lifecycle rule to handle the transition automatically.
The examples in this topic use appendable objects in the examplebucket bucket with the prefix appendobjects/ that were last modified more than 30 days ago.
Prerequisites
Before you begin, ensure that you have:
Submitted a ticket at the Alibaba Cloud service center to get approval for the SealAppendObject operation
A prefix that is specific enough to avoid accidentally transitioning other objects (for example,
appendobjects/)
How it works
List all appendable objects that match your target criteria.
Run SealAppendObject on each object to convert it to a normal object.
Configure a lifecycle rule to transition the converted objects to Cold Archive.
After you configure the lifecycle rule, it takes effect and runs for the first time early on the following day.
Lifecycle rules apply to normal objects — objects uploaded with PutObject, multipart upload, or appendable objects converted with SealAppendObject.
Step 1: List the appendable objects to process
Filter your bucket to find all appendable objects eligible for conversion. The target objects must meet all four conditions:
Object type is
AppendableStorage class is not
ColdArchiveorDeepColdArchiveLast-Modified is more than 30 days ago
The
SealedTimefield is absent (object has not been sealed)
The Last-Modified behavior depends on whether versioning is enabled on the bucket:
Versioning disabled: Last-Modified updates each time you append data to the object.
Versioning enabled or suspended: Last-Modified is set at initial upload and does not update on subsequent appends. As a result, this filter returns all appendable objects initially uploaded more than 30 days ago, regardless of when data was last appended.
ossutil
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 output:
oss://examplebucket/appendobjects/unsealed_object1.txt
oss://examplebucket/appendobjects/unsealed_object2.txt
oss://examplebucket/appendobjects/unsealed_object3.txtAPI
Call GetBucket (ListObjects) or ListObjectsV2 (GetBucketV2) to list objects under the prefix, then filter the results using the four conditions above.
Step 2: Seal the appendable objects
Run SealAppendObject on each object from Step 1. SealAppendObject requires the current object size as the position parameter, so retrieve the size first.
ossutil
Repeat the following two commands for each object:
Get the object size (
Content-Length):ossutil stat oss://examplebucket/appendobjects/unsealed_object1.txtSeal the object, passing the
Content-Lengthvalue asposition:ossutil api invoke-operation \ --op-name seal \ --method POST \ --bucket examplebucket \ --key appendobjects/unsealed_object1.txt \ --parameters seal \ --parameters position=65536
API
For each object:
Get the object size: retrieve the
<Size>value from the GetBucket (ListObjects) or ListObjectsV2 (GetBucketV2) response.Call SealAppendObject with the
<Size>value as thepositionparameter. The object is converted to a non-appendable state.
Step 3: Create a lifecycle rule
Configure a lifecycle rule to automatically transition the sealed objects to Cold Archive storage.
Console
Log on to the OSS console.
Click Buckets, then click examplebucket.
Choose Data Management > Lifecycle.
Click Create Rule and configure the settings as shown below. Keep the defaults for all other parameters.
Area Configuration item Value Basic settings Status Start Applied to Object Prefix Prefix appendobjects/Policy for current versions Object lifecycle Specify Days Lifecycle-based rules Transition to Cold Archive 30 days after last Modified Time Click OK.
ossutil
Create a file named
lifecycle.xmlwith the following content:<LifecycleConfiguration> <Rule> <ID>rule1</ID> <Prefix>appendobjects/</Prefix> <Status>Enabled</Status> <Transition> <Days>30</Days> <StorageClass>ColdArchive</StorageClass> </Transition> </Rule> </LifecycleConfiguration>Apply the rule to the bucket:
ossutil api put-bucket-lifecycle --bucket examplebucket --lifecycle-configuration file://lifecycle.xml
API
Call PutBucketLifecycle with the XML content in the request body:
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
The lifecycle rule takes effect and runs for the first time early the following day. To confirm the transition was successful, check the storage class of the target objects:
OSS console: Navigate to the bucket and inspect the object details.
ossutil: Run
ossutil stat oss://examplebucket/appendobjects/<object-name>and check theStorageClassfield.