When versioning is enabled for a bucket, overwritten or deleted data will be saved as previous version. Versioning allows you to restore previous versions of objects that have been overwritten or deleted.

Note
  • You cannot configure compliant retention policies or mirroring-based back-to-origin rules for a versioning-enabled bucket, nor enable versioning for a bucket that has compliant retention policies or mirroring-based back-to-origin rules configured.
  • If versioning is enabled for a bucket, the x-oss-forbid-overwrite request header that is specified when an object is uploaded to the bucket will not take effect. For more information, see Request headers.
  • When versioning is enabled for a bucket, all overwritten or deleted objects are saved as previous versions. OSS calculates the object size of each version and charges storage fees. To minimize storage costs, we recommend that you delete previous versions that are no longer needed in a timely manner.
  • After you enable versioning for a bucket, the versioning state cannot be rolled back to unversioned. Versioning can only be enabled or suspended.

Implementation modes

You can use one of the following methods to configure versioning.

Implementation mode Description
Console User-friendly and intuitive web application
ossutil High-performance command-line tool
OSS SDK for Java SDK demos for various programming languages
OSS SDK for Python
OSS SDK for C++
OSS SDK for Go

Scenarios

  • Restore user data from accidental deletion

    OSS does not provide the recycle bin function. To restore deleted data, you must use an offline or third-party backup tool.

  • Restore overwritten data

    Online collaborative documents and documents stored in online storage are frequently modified. In online office scenarios, a large number of temporary versions are generated when files are edited. Users must find versions of a certain point in time.

Principles

The versioning state of a bucket applies to all objects in the bucket. After you enable versioning for a bucket, all objects in the bucket are subject to versioning. Each version has a unique version ID.

  • A bucket can be in any one of the following versioning states:
    • Unversioned (default)
    • Versioning-enabled

      For more information about operations on objects in versioning-enabled buckets, see Enable versioning.

    • Versioning-suspended

      For more information about operations on objects in versioning-suspended buckets, see Suspend versioning.

  • The following users can configure versioning for buckets:
    • Alibaba Cloud accounts
    • RAM users or roles who have been granted OSSFullAccess
    • RAM users or roles who have been granted PutBucketVersioning