Object Storage Service (OSS) allows you to configure versioning to protect data at the bucket level. After you enable versioning for a bucket, data that is overwritten or deleted in the bucket is saved as a previous version. You can use versioning to restore a previous version of an object that is accidentally overwritten or deleted.

Background information

If you enable versioning for a bucket, you are charged for the storage of all versions of objects in the bucket. If you download or restore a previous version of an object, you are charged for the requests and traffic. To prevent unnecessary storage fees, we recommend that you delete the previous versions of objects that you no longer need at your earliest opportunity. For more information, see Overview.

Enable versioning

When versioning is enabled for a bucket, OSS specifies a unique ID for each version of an object stored in the bucket.

  • Enable versioning when you create a bucket
    1. Log on to the OSS console.
    2. In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
    3. In the Create Bucket panel, configure the parameters.

      Set Versioning to Activate. For more information about how to configure other parameters, see Create buckets.

    4. Click OK.
  • Enable versioning for an existing bucket
    1. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket for which you want to enable versioning.
    2. In the left-side navigation pane, choose Redundancy for Fault Tolerance > Versioning.
    3. Click Configure. Set Versioning to Enabled.
    4. Click Save.

After versioning is enabled for a bucket, you can view all versions of objects in the bucket on the Files page. If you want to view only the current versions of objects, set Display Previous Versions to Hide. Hiding previous versions of objects does not increase the response speed when you list objects. If the response speed is slow when you list objects, see Low response speed to troubleshoot and fix the problem.

Restore a previous version

To restore a specified previous version of an object as the current version, perform the following steps:

  1. In the left-side navigation pane, click Files.
  2. Restore a specified previous version of an object as the current version.
    Notice You can restore only one previous version of an object at a time. The previous version that you want to restore cannot be a delete marker.
    • Restore the previous version of an object

      Click Restore in the Actions column that corresponds to the previous version that you want to restore.

    • Restore the previous versions of multiple objects

      Select the previous versions that you want to restore and then choose Batch Operation > Restore.

Download a specified version of an object

To download a specified version of an object, perform the following steps:

  1. In the left-side navigation pane, click Files.
  2. Click the version that you want to download. In the panel that appears, click Download on the right side of Object URL.
  3. Select the location where you want to store the downloaded version and then click Save.

Delete a previous version of an object

To minimize storage costs, we recommend that you delete the previous versions of objects that you no longer need at your earliest opportunity.

Warning You cannot restore a previous version of an object after it is deleted. Proceed with caution.
  1. In the left-side navigation pane, click Files.
  2. Click Permanently Delete in the Actions column that corresponds to the previous version you want to delete.
    To delete multiple previous versions of an object, select the previous versions that you want to delete and choose Batch Operation > Permanently Delete.
  3. Click OK.

You can also configure lifecycle rules to allow OSS to periodically delete previous versions. For more information, see Configure lifecycle rules.

Suspend versioning

You can suspend versioning for a versioned bucket to stop OSS from generating new versions for objects. If a new version is generated for an object in a versioning-suspended bucket, OSS sets the ID of the new version to null and retains the previous versions of the object.

To suspend versioning for a bucket, perform the following steps:

  1. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket for which you want to suspend versioning.
  2. In the left-side navigation pane, choose Redundancy for Fault Tolerance > Versioning.
  3. Click Configure and set the versioning state to Suspended.
  4. Click Save.