All checks
Low S3 · account

S3 directory buckets should have lifecycle configurations

Ensures S3 directory buckets have at least one enabled lifecycle rule. A lifecycle configuration whose rules are all disabled acts on no object, so it does not count.

service
S3
severity
Low
scope
evaluated once per account

How to fix it

Add an enabled lifecycle rule to the directory bucket expiring objects after a number of days, plus one aborting incomplete multipart uploads. Those are the only two actions directory buckets support: there are no storage class transitions, and no versioning, so an expired object is gone. The CLI and Terraform routes replace the bucket's whole lifecycle configuration, so include the rules it already has. This is a different resource from the general purpose buckets S3.13 covers.

In the console

S3 → Directory buckets → the bucket → Management → Lifecycle rules

With the AWS CLI

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

With Terraform

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

  rule {
    id     = "expire-objects"
    status = "Enabled"

    expiration {
      days = 7
    }
  }
}

See which of your accounts this check is failing on.

Book a demo