Skip to main content

S3 Lifecycle to Intelligent-Tiering

πŸ“¦ Overview​

This Terraform module applies a lifecycle rule to an existing Amazon S3 bucket, automatically transitioning objects to the INTELLIGENT_TIERING storage class after 30 days.

It’s ideal for production or archive environments where access patterns are unpredictable and manual tiering is inefficient.


βœ… Key Features​

  • Automatically transitions S3 objects to INTELLIGENT_TIERING after 30 days
  • Reduces costs while maintaining high availability and low latency
  • Adapts to shifting access patterns without user intervention
  • Supports tagging and is reusable across environments

πŸ’Ό Use Cases​

  • Data lakes with variable or unknown access patterns
  • Long-term logs, backups, or exports with inconsistent access
  • Secure buckets needing smarter storage management
  • Cost-conscious workloads that require availability but not tiering oversight

πŸ“₯ Input Variables​

NameTypeDescription
regionstringAWS region where the target S3 bucket exists
bucket_namestringName of the S3 bucket to apply the lifecycle rule to
transition_daysnumberNumber of days before transitioning objects to INTELLIGENT_TIERING
environmentstringTag to specify the deployment environment (e.g., dev, staging, prod)

πŸ“€ Outputs​

NameDescription
bucket_nameThe name of the S3 bucket with the lifecycle rule
rule_idThe ID of the lifecycle rule applied

πŸš€ Deployment Readiness​

  • βœ… Compatible with Terraform 1.0+
  • βœ… Tested with AWS provider 5.x
  • πŸ§ͺ Requires an existing S3 bucket and permissions to apply lifecycle policies

πŸ› οΈ Example Usage​

module "s3_lifecycle_intelligent_tiering" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//storage/s3-lifecycle-intelligent-tiering?ref=v1.0.0"

region = "us-east-1"
bucket_name = "archiphire-prod-data"
transition_days = 30
environment = "prod"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

🧹 Cleanup Options​

Terraform Destroy (for test environments):

terraform destroy

or

tofu destroy

⚠️ This only removes the lifecycle rule. Your S3 bucket and its contents will remain unaffected unless manually deleted.

πŸ›‘οΈ Notes​

This is a Level 1 storage optimization module focused on cost control. To extend it further, consider pairing with:

s3-secure-bucket s3-access-logging

πŸ”’ Deployment Package Notice​

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.