Lets have a scenario in which you are updating and reading your files very frequently. Then sometimes it may happen that the the files are deleted or updated by mistake so how does we get access to previous files. This is where S3 versioning comes in. If we enable this then AWS keeps the previous versions also stored in S3 and we can go back to previous files.
Versioning is enabled at the bucket level. It allows us to keep different copies of same files in AWS S3 and protects us from unintended updates and deletes. So, if you delete an object S3 adds a delete marker and delete marker becomes the current version of the file.
With respect to versioning a buckets can be in one of three states:
Unversioned (the default) - When versioning is disabled in a bucket. In this files have a null version by default.
Versioning(enabled)- Versioning is enabled in a bucket. This works normal each files has all its versions.
Versioning(suspended) - Versioning was once enabled but is disabled right now. The previous versions of files are not deleted in this.
In the next exercise we will see how versioning works in S3 and how it can be helpful.