OSS uses the Write Once Read Many (WORM) retention policy to specify the protection period of objects in a bucket. During the protection period, the protected objects cannot be modified or deleted.

Background information

The retention policy feature is in public preview. To use this feature, click here to submit a ticket and contact technical support personnel.
Notice
  • A bucket cannot have both versioning and retention policies configured at the same time. If versioning is enabled for a bucket, you cannot configure retention policies for the bucket. For more information about versioning, see Overview.
  • For more information about the retention policy, see Retention policy.

Procedure

  1. Log on to the OSS console.
  2. Click Buckets, and then click the name of the target bucket.
  3. Choose Basic Settings > Retention Policy. In the Retention Policy section, click Configure.
  4. Click Create Policy. The Create Policy dialog box appears.
  5. Set Retention Period for the retention policy. Valid values of Retention Period range from one day to 70 years.
  6. Click OK.
    After the policy is created, the status indicates IN_PROGRESS. You can click Lock or Delete to lock or delete a policy in the IN_PROGRESS state.
  7. Click Lock.
  8. In the message that appears, click OK.
    Note
    • The policy status becomes LOCKED. You cannot delete the policy or shorten the protection period. However, you can click Edit to prolong the protection period.
    • During the protection period, data in the bucket is protected. If you attempt to delete or modify the data, the following error message is displayed: The file is locked and cannot be operated.

Calculate the expiration time for objects

You can calculate the expiration time by adding the retention period and last update time of objects in buckets. For example, the retention policy for Bucket A specifies the retention period as 10 days. The last update time of an object in the bucket is 12:00 on March 1, 2019. The object expires at 12:01 on March 11, 2019. For more information about the rules of the compliant retention policy, see the "Rules" section in Compliant retention policy.