S3 bucket has a lifecycle configuration enabled
Amazon S3 buckets use Lifecycle configurations with at least one rule Status: Enabled to automate object Transitions and Expiration based on age, prefix, or tags
Risk
Without lifecycle rules, objects persist indefinitely, driving costs and retaining sensitive data beyond policy. Unchecked log/version growth strains operations and recovery. Long-lived data increases exposure if the account is compromised and can break required deletion timelines, affecting confidentiality and availability.
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks s3_bucket_lifecycle_enabledRecommendation
Define Lifecycle policies by data classification: set Expiration to enforce retention, use Transitions to lower-cost classes, and enable AbortIncompleteMultipartUpload. For critical logs, keep versioning and, if required, Object Lock. Limit who can change lifecycle using least privilege and separation of duties.
Remediation
CLI
aws s3api put-bucket-lifecycle-configuration --bucket <BUCKET_NAME> --lifecycle-configuration '{"Rules":[{"Status":"Enabled","Filter":{"Prefix":""},"AbortIncompleteMultipartUpload":{"DaysAfterInitiation":7}}]}'Terraform
# Minimal lifecycle configuration to mark the bucket as having an enabled rule
resource "aws_s3_bucket_lifecycle_configuration" "<example_resource_name>" {
bucket = "<example_resource_name>"
rule {
status = "Enabled" # CRITICAL: Enables lifecycle rule to pass the check
filter {} # Applies to all objects
abort_incomplete_multipart_upload {
days_after_initiation = 7 # Minimal action to satisfy schema
}
}
}NativeIaC
# CloudFormation: enable a minimal S3 Lifecycle configuration
Resources:
<example_resource_name>:
Type: AWS::S3::Bucket
Properties:
LifecycleConfiguration: # CRITICAL: Adds a Lifecycle configuration to the bucket
Rules:
- Status: Enabled # CRITICAL: Rule must be Enabled to pass the check
Filter:
Prefix: "" # Applies to all objects
AbortIncompleteMultipartUpload:
DaysAfterInitiation: 7 # Minimal action to satisfy schemaOther
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.s3.s3_client import s3_client
class s3_bucket_lifecycle_enabled(Check):
def execute(self):
findings = []
for bucket in s3_client.buckets.values():
report = Check_Report_AWS(metadata=self.metadata(), resource=bucket)
report.status = "FAIL"
report.status_extended = f"S3 Bucket {bucket.name} does not have a lifecycle configuration enabled."
if bucket.lifecycle:
for configuration in bucket.lifecycle:
if configuration.status == "Enabled":
report.status = "PASS"
report.status_extended = f"S3 Bucket {bucket.name} has a lifecycle configuration enabled."
break
findings.append(report)
return findingsReferences
- https://docs.aws.amazon.com/securityhub/latest/userguide/s3-controls.html#s3-13
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-set-lifecycle-configuration-intro.html
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/aws/S3/lifecycle-configuration.html