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

Implementation mode

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

Implementation mode Description
Console A user-friendly and intuitive web application
ossutil A 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

Precautions

  • Retention policies, mirroring-based back-to-origin, and static website hosting cannot be configured for a versioning-enabled bucket. Similarly, versioning cannot be enabled for a bucket for which retention policies, mirroring-based back-to-origin, or static website hosting is 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 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.
  • When versioning is enabled for a bucket, the versioning state of the bucket can only be suspended and cannot be rolled back to unversioned.

Scenarios

  • Restore user data from accidental deletion

    OSS does not provide the recycle bin feature. 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 need to 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 that can be performed 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 the OSSFullAccess permission
    • RAM users or roles who have been granted the PutBucketVersioning permission