AWS › S3 & Storage

What is S3 versioning, and how does it help protect against accidental object deletion or overwrite?

Intermediate

Answer

S3 versioning, once enabled on a bucket, keeps every version of an object every time it is overwritten or deleted, meaning an accidental deletion simply adds a delete marker rather than truly removing the underlying data, and an accidental overwrite similarly preserves the previous version, both of which can be easily restored, providing strong protection against data loss caused by an application bug or human error.
aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled
Real-world example A development team enables versioning on their critical configuration bucket, and when someone accidentally overwrites an important configuration file with the wrong content, they simply restore the previous version rather than needing to recreate the file entirely from memory or a separate backup.

Common follow-ups: How does S3 versioning affect the storage costs for a bucket over time?;How do you permanently delete a specific old version of an object once it is no longer needed?