Restoring previous versions
You can use versioning to retrieve previous versions of an object. There are two approaches to doing so:
-
Copy a previous version of the object into the same bucket.
The copied object becomes the current version of that object and all object versions are preserved.
-
Permanently delete the current version of the object.
When you delete the current object version, you, in effect, turn the previous version into the current version of that object.
Because all object versions are preserved, you can make any earlier version the current version by copying a specific version of the object into the same bucket. In the following figure, the source object (ID = 111111) is copied into the same bucket. Amazon S3 supplies a new ID (88778877) and it becomes the current version of the object. So, the bucket has both the original object version (111111) and its copy (88778877). For more information about getting a previous version and then uploading it to make it the current version, see Retrieving object versions from a versioning-enabled bucket and Uploading objects.
![Illustration that shows copying a specific version of an object into the same bucket to make it the current version.](images/versioning_COPY2.png)
A subsequent GET
retrieves version 88778877.
The following figure shows how deleting the current version (121212) of an object leaves the previous version (111111) as the current object. For more information about deleting an object, see Deleting a single object.
![Illustration that shows deleting the current version of an object leaves the previous version as the current object.](images/versioning_COPY_delete2.png)
A subsequent GET
retrieves version 111111.
Note
To restore object versions in batches, you can use the
CopyObject
operation. The CopyObject
operation copies each
object that is specified in the manifest. However, be aware that objects aren't
necessarily copied in the same order as they appear in the manifest. For
versioned buckets, if preserving current/non-current version order is important,
you should copy all non-current versions first. Then, after the first job is
complete, copy the current versions in a subsequent job.
To restore previous object versions
Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at https://console.amazonaws.cn/s3/
. -
In the Buckets list, choose the name of the bucket that contains the object.
-
In the Objects list, choose the name of the object.
-
Choose Versions.
Amazon S3 shows all the versions for the object.
-
Select the check box next to the Version ID for the versions that you want to retrieve.
-
Choose Actions, choose Download, and save the object.
You also can view, download, and delete object versions in the object overview panel. For more information, see Viewing an object overview in the Amazon S3 console.
Important
You can undelete an object only if it was deleted as the latest (current) version. You can't undelete a previous version of an object that was deleted. For more information, see Using versioning in S3 buckets.
For information about using other Amazon SDKs, see the Amazon Developer Center