All checks
Medium S3 · regional

S3 general purpose buckets with versioning enabled should have Lifecycle configurations

Checks that a versioned S3 general purpose bucket has at least one enabled lifecycle rule. With versioning on, every overwrite and delete keeps the previous version, billed as storage, so without a rule that expires noncurrent versions the bucket grows without limit.

service
S3
severity
Medium
scope
evaluated in every region

How to fix it

In the console

S3 → the bucket → Management → Create lifecycle rule

With the AWS CLI

aws s3api put-bucket-lifecycle-configuration --bucket <bucket-name> --lifecycle-configuration file://lifecycle.json

With Terraform

resource "aws_s3_bucket_lifecycle_configuration" "this" {
  bucket = var.bucket_name

  rule {
    id     = "expire-noncurrent-versions"
    status = "Enabled"

    noncurrent_version_expiration {
      noncurrent_days = 90
    }
  }
}

See which of your accounts this check is failing on.

Book a demo