When versioning is enabled for a bucket, data that is overwritten or deleted is saved as a previous version of an object. You can use versioning to recover objects in a bucket to any previous version, and protect your data from being accidentally overwritten or deleted.

Background information

When versioning is enabled, OSS specifies a unique ID for each version of all objects in a bucket. The content and ACL of existing objects in the bucket remain unchanged. Versioning protects you from unintended overwrites and deletions. You can also use versioning to retrieve a previous version of an object and recover the previous version as the current version at any time. When a previous version is no longer needed, you can delete it manually or configure lifecycle rules to delete it automatically. For more information about how to configure lifecycle rules, see Manage lifecycle rules.
Notice
  • When versioning is enabled for a bucket, the versioning status of the bucket can only be suspended and cannot be rolled back to unversioned.
  • When versioning is enabled for a bucket, all overwritten or deleted objects in the bucket are saved as previous versions. OSS calculates the object size of each version and charges storage fees. We recommend that you delete unnecessary previous versions in a timely manner to minimize storage costs.
  • For more information, see Overview.

Enable versioning

  • Enable versioning when creating a bucket
    1. Log on to the OSS console.
    2. On the Overview page, click Create Bucket in the upper-right corner.
    3. In the Create Bucket dialog box that appears, set parameters.

      Set Versioning to Enable. For more information about parameter descriptions, see Create buckets.

    4. Click OK.
  • Enable versioning for an existing bucket
    1. Log on to the OSS console.
    2. Click Buckets, and then click the name of the target bucket.
    3. Choose Redundancy for Fault Tolerance > Versioning.

      You can also click Buckets. Then, click Configure in the Versioning column corresponding to the target bucket.

    4. Click Configure. Select Enabled.
      Note If you no longer need additional object versions, you can select Suspended after you enable versioning for a bucket. OSS specifies that the ID of a new version is null and no more previous versions are generated. However, the existing versions are retained.
    5. Click Save.

Manage object versions

  • Delete previous versions
    We recommend that you delete unnecessary previous versions in a timely manner to minimize storage costs.
    1. Log on to the OSS console.
    2. Click Buckets, and then click the name of the target bucket.
    3. Click Files. Select Show Previous Versions of the Files in the upper-right corner.
    4. Select previous versions that are no longer used. Click Delete.
      Warning
      • Previous versions cannot be recovered after being deleted. Exercise caution when you perform this operation.
      • If you delete the current version, the latest previous version becomes the current version.
  • Download previous versions
    You can download previous versions of objects stored in a bucket at any time.
    1. Log on to the OSS console.
    2. Click Buckets, and then click the name of the target bucket.
    3. Click Files. Select Show Previous Versions of the Files in the upper-right corner.
    4. Click the specified object version. In the dialog box that appears, you can view information about the object version.
    5. Click Download next to Signed URL.
  • Recover previous versions
    OSS provides the following methods to recover a previous version as the current version:
    • Delete the current version
      You can delete the current version of an object. The latest previous version becomes the current version. For information about how to delete the current version of an object, see Delete previous versions.
      Warning Previous versions cannot be recovered after being deleted. Exercise caution when you perform this operation.
    • Copy a previous version to overwrite the current version
      To recover the specified previous version as the current version, we recommend that you copy a specified version to the current directory to overwrite the current version. For more information, see: