Restore the object from S3 Versioning in AWS
S3 versioning is the feature to restore the object which accidentally deleted or updated. You can restore the deleted object. You can also restore the updated object with old version object present in bucket if you have enabled Versioning feature of S3.
Advantage:
Restored the deleted file
Compared the old version file if needed.
Archive the old version of files for later use.
Disadvantage
It multiple the size, old size of object plus new object size upload. So to keep track this we also need to enabled life cycle policies.
Current size of object is all the size of object versions present in S3. So it increase size exponentially.
It will cost higher for maintaining the Version of each file.
Following are the steps show the restoration process of object in S3 bucket
1. Login the AWS console.
2. Go the the S3 Service.
3. Check bucket has enabled versioning.
3. Upload 1.txt file with three different version.
1.txt content for three version file updated in S3 bucket:
Version 1: This is first version.
Version 2: This is first version. This is second version.
Version 3: This is first version. This is second version. This is third version.
Check in bucket one file is present as latest updated version shown as:
4. Now you can check the version of 1.txt file as below:
5. Deleted the 1.txt file from the S3 bucket. Now no file left in normal window.
Select the FILENAME and go to ACTION button and select DELETE option and on new pop up window press DELETE button. Now you bucket is empty as shown below:
6. We check the version tab show window for the bucket. It show deleted marked for file 1.txt latest version as shown.
7. For restore the 1.txt file, you need to select the deleted mark line then go to ACTION button and select the DELETE option, from pop-up window press DELETE button. Latest version changed to backup file as shown below:
8. Then you check the 1.txt file in normal window.
9. You restored your 1.txt file from S3 bucket by using versioning feature of S3 bucket.
You can also check and compare the old version from versioning in S3
You can directly open the old version of 1.txt file by assigning them PUBLIC privileges and access them directly through link.
In example click on second version then assign PUBLIC privilieges then access this text file from URL mentioned in following snapshot: