Amazon S3 Versioning is a feature that helps protect your data by preserving multiple versions of an object in the same bucket, allowing you to recover from accidental deletion or overwrites .
S3 Versioning is a way to keep multiple variants of an object in the same bucket. By default, versioning is disabled on all new buckets, but you can enable it at any time . Once enabled, S3 automatically assigns a unique version ID to each object uploaded. If you later upload a new version of the same object, the previous version is retained instead of being overwritten. This provides a powerful safety net against unintended user actions and application failures .
When versioning is enabled, overwriting an object creates a new version with its own version ID, while the original version remains accessible .
If you delete an object, S3 does not permanently remove it. Instead, it adds a 'delete marker' on top of the stack. This marker becomes the current version, making the object appear deleted in standard listings, but all previous versions are still recoverable .
To permanently delete an object, you must delete each version individually or remove the delete marker to restore the previous version .
Objects stored before versioning was enabled receive a version ID of null .
A bucket can be in one of three states: unversioned (default), versioning-enabled, or versioning-suspended. Once versioning is enabled, the bucket can never return to an unversioned state—it can only be suspended, which stops new versions from being created but retains existing versions . Each version is a complete object, not just a diff of changes, so you are charged for every version stored. For example, three versions of a 1GB object will be billed as 3GB of storage . To control costs, it's recommended to combine versioning with S3 Lifecycle rules to automatically transition older versions to lower-cost storage tiers or expire them when no longer needed .