Description
S3 Versioning preserves earlier object versions after you enable it. Suspending it leaves existing versions in place.
Potential impact
An accidental or malicious overwrite can destroy the last recoverable copy when there is no earlier version or separate backup.
Remediation
- Set
Status: EnabledunderVersioningConfigurationfor buckets that need recoverable history. Create two versions of a test object and restore the earlier one. - Set lifecycle expiration to meet retention needs and storage costs. Restrict permanent version deletion and consider S3 Object Lock if versions must be immutable.
Examples
Both excerpts define the same bucket. Configure replication separately if you need it.
Before
yaml
Resources:
RecordServiceS3Bucket:
Type: AWS::S3::Bucket
A new bucket created without a versioning setting has no version history.
After
yaml
Resources:
RecordServiceS3Bucket:
Type: AWS::S3::Bucket
Properties:
VersioningConfiguration:
Status: Enabled
Enabling versioning keeps versions for subsequent changes. It cannot recover data already lost.