DEV Community

This is Learning

Setting File Versioning in S3

Ajit Singh
Angular Collborator | Frontend Developer | Currently learning AWS
・1 min read

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.

S3 versioning

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:

  1. Unversioned (the default) - When versioning is disabled in a bucket. In this files have a null version by default.

  2. Versioning(enabled)- Versioning is enabled in a bucket. This works normal each files has all its versions.

  3. 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.

Discussion (0)