AWS S3 Versioning, MFA Delete, and Websites
Explore how to manage file versions using Amazon S3 versioning, enhance data security with MFA delete requiring multi-factor authentication for critical changes, and configure S3 buckets to host static websites. Understand cross-origin resource sharing (CORS) policies to safely control resource access between different sites. This lesson helps you deploy and secure static web content while protecting against accidental deletions.
We'll cover the following...
Versioning
Versioning allows us to keep multiple versions of the same file in an S3 bucket. When versioning is enabled and we add a new file to an existing key, instead of overwriting the file, S3 adds a new version to the file.
In the example below, when versioning is turned off, the new tree.jpg file replaces the existing tree.jpg file. When versioning is enabled, the new tree.jpg file is added as a new version in the S3 bucket. When we enable versioning in a bucket, the existing objects in the bucket will have a null version.
Versioning is turned off by default and should be explicitly enabled. Note that once versioning is enabled, it can’t be turned off, only suspended.
-
If we suspend versioning in a bucket:
- The existing versions of the objects and any lifecycle rules configured for these versions still exist.
- Newly added objects with the same key as an existing object will replace the existing object.