AWS Series — How to backup our data in S3 Storage?
S3 is the key AWS service and is used by other AWS services in the back ground. It is very important to be aware of S3 concepts and the ability of it.
If you are not sure what S3 is go over these articles
- AWS Series — Simple Storage Service : The most used storage in cloud
- AWS Series — How do we secure S3 data?
Now that you got fair idea of what is S3 and How to secure the data. Let us look at some details about S3 Versioning.
Versioning
You can enable versioning in S3 so you can have multiple version of an object with S3.
Advantages of Versioning —
- All Versions — All versions of an object are stored in S3. this includes all writes and even f you delete an object
- Backup — Can be a great backup tool.
- Cannot be Disabled — Once enabled, versioning cannot be disabled — Only suspended
- Lifecycle Rules — Can be integrated with lifecycle rules.
- Supports MFA — Can support multi-factor authentication.
How to Turn on Versioning?
Go to AWS Management Console > Storage > S3. Now open the bucket that you would like to enable the versioning.
Go to Properties > Bucket Versioning

click on Edit and Enable the versioning.

Save the changes.
Go to the objects and you will see an option Show Versions.

If you check this option, you would be able to see the Version ID.

Initially, it would be null. As we upload to the same file, we get the version ID

If we click on the previous version and the object URL you get Access Denied. This means, our public setting is not applicable for the older versions.
How can we delete the object if versioning is enabled?
Select a file in S3 for which versioning is enabled. Click on the delete object.

This will just remove from the bucket which is no more accessible but when we go to show versions, we can still see the index.html as Delete marker as shown above.
To Restore the file —Select the delete marker file and click on delete. This will delete the marker file permanently.

Now when you go back to your bucket, you can find the index.html restored.
Points To Remember —
- All Versions — All versions of an object are stored in S3. This includes all writes and even if you delete an object.
- Backup — Can be a great backup tool.
- Cannot be Disabled — Once enabled, versioning cannot be disabled — only suspended.
- Lifecycle rules — Can be integrated with lifecycle rules.
- Supports MFA — Can support multi-factor authentication.