OSS allows you to configure versioning for a bucket to protect objects stored in the bucket. After you enable versioning for a bucket, objects that are overwritten or deleted in the bucket are saved as previous versions. You can use versioning to recover a previous version of an object that was accidentally overwritten or deleted.
Background information
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
- Log on to the OSS console.
- In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
- In the Create Bucket panel, configure parameters.
Set Versioning to Enable. For more information about how to configure other parameters, see Create buckets.
- Click OK.
- Enable versioning for an existing bucket
- 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.
- Choose .
- Click Configure. Set Versioning to Enabled.
- 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. Listing previous versions of objects do not affect the performance of the console. If the response time of the console is slow when you list objects, see FAQ to troubleshoot the problem.
Recover previous versions
You can recover a specified previous version of an object as the current version.
Download a specified version of an object
You can download a specified previous version of an object.
- On the Overview page, click Files in the left-side navigation pane.
- Click the version that you want to download. In the panel that appears, click Download to the right of Object URL.
- Select the location where you want to store the downloaded version and then click Save.
Delete the previous version of an object
To minimize storage costs, we recommend that you delete previous versions that you no longer need at your earliest opportunity.
You can also configure lifecycle rules to allow OSS to delete previous versions on a regular basis. 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.
You can perform the following steps to suspend versioning for a bucket:
- 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.
- Choose .
- Click Configure and then set the versioning state to Suspended.
- Click Save.