Free — no signup required

S3 Lifecycle Policies: Automating Tier Transitions

2 min read

Automating Data Temperature Management

Manually moving objects between storage tiers doesn't scale. AWS S3 Lifecycle Policies are rules you attach to a bucket that automatically transition objects to cheaper tiers — or delete them entirely — based on their age. This is the primary mechanism for implementing tiered storage at scale without human intervention.

A lifecycle policy answers two questions: "When should this data get cheaper storage?" and "When should this data be deleted?"

Anatomy of a Lifecycle Policy

Here is a complete lifecycle policy for application logs. It transitions logs through tiers as they age and deletes them after one year:

{
  "Rules": [
    {
      "ID": "application-log-lifecycle",
      "Status": "Enabled",
      "Filter": {
        "Prefix": "logs/"
      },
      "Transitions": [
        {
          "Days": 30,
          "StorageClass": "STANDARD_IA"
        },
        {
          "Days": 90,
          "StorageClass": "GLACIER_IR"
        },
        {
          "Days": 180,
          "StorageClass": "DEEP_ARCHIVE"
        }
      ],
      "Expiration": {
        "Days": 365
      }
    }
  ]
}

What this policy does:
- Objects in the logs/ prefix start in S3 Standard (hot).
- After 30 days → moved to Standard-IA (warm). Storage cost drops ~45%.
- After 90 days → moved to Glacier Instant Retrieval (cold). Storage cost drops ~83% from Standard.
- After 180 days → moved to Deep Archive (frozen). Storage cost drops ~96% from Standard.
- After 365 days → deleted permanently.

Minimum Duration Charges

A critical gotcha: S3 charges a minimum storage duration for IA and Glacier tiers. Standard-IA has a 30-day minimum; Glacier has a 90-day minimum; Deep Archive has a 180-day minimum. If you transition an object to Deep Archive and delete it after 10 days, you still pay for 180 days. This means lifecycle policies should only transition objects that you're confident will remain for at least the minimum duration period.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free