S3 general purpose buckets should have versioning enabled
Checks that versioning is enabled on the S3 general purpose bucket; a bucket where it is suspended or was never set fails. With versioning, an overwrite keeps the previous version and a simple delete only adds a delete marker, so data can be recovered after an accidental delete, a bad write or an application failure.
- service
- S3
- severity
- Low
- scope
- evaluated once per account
How to fix it
- Can't be undone: Versioning can later be suspended but never removed, so the bucket can never return to being unversioned.
- Affects another check: Enabling versioning brings the bucket into S3.10, which fails until it has an enabled lifecycle rule, such as one expiring noncurrent versions.
- Interrupts service: For up to 15 minutes after versioning is first enabled, reading an object written in that time can return 404 NoSuchKey, so AWS advises pausing writes.
In the console
S3 → the bucket → Properties → Bucket Versioning
- Bucket Versioning
- Enable
With the AWS CLI
aws s3api put-bucket-versioning --bucket <bucket-name> --versioning-configuration Status=EnabledWith Terraform
resource "aws_s3_bucket_versioning" "this" {
bucket = var.bucket_name
versioning_configuration {
status = "Enabled"
}
}
See which of your accounts this check is failing on.
Book a live scan