/storage_letter.

S3 Lifecycle Policy Configuration

Automatic data movement prevents storage costs from growing invisibly out of control.

Sponsored by Archil

Storage Letter Editors
· 10 min read · Updated
Cover illustration for “S3 Lifecycle Policy Configuration”
S3 Bucket Fundamentals · August 4, 2026 · 10 min read · 2,360 words

S3 lifecycle policies are rule sets that automatically move data to cheaper storage or delete it on a schedule, and most buckets don't have one configured. A bucket that grows by a few gigabytes a day looks harmless, right up until finance asks why the storage line item tripled. Most teams aren't careless about cost. Data aging is invisible unless something is watching for it, and nothing watches by default.

Storage data follows a pattern that's easy to predict and easy to ignore. A log file gets read constantly in its first few days, gets pulled up occasionally over the following month for some debugging session, and then goes quiet, maybe forever. Without a policy telling it what to do, that file stays in Standard tier indefinitely, billed at the Standard rate, for no better reason than nobody told it to move.

A lifecycle policy fixes that with a JSON rule set attached to a bucket, or to a prefix inside one, telling AWS to do one of two things over time: transition the object to a cheaper storage class, or expire it. The rule runs on AWS's own schedule in the background indefinitely, with no human checking in. That's the appeal of the whole mechanism, and it's also why so many buckets still don't have one. Writing the rule takes a deliberate afternoon. Not writing it costs nothing that shows up right away, which makes it exactly the kind of task that falls off the sprint board forever.

Creating or applying a lifecycle policy costs nothing. The fees come from per-object transition requests and, separately, from retrieval charges if archived data gets pulled back out. Those two charges get confused constantly, and not just by people new to S3. Engineers who've run buckets for years mix them up too, because the pricing page separates them in a way that doesn't match how anyone thinks about "moving a file." Lifecycle policies stand out among cloud cost controls because they don't need babysitting once they're live. Compute rightsizing needs someone checking utilization dashboards on a recurring basis. A lifecycle rule, once correct, keeps being correct. The rest of this piece is about getting it correct the first time: the storage tiers data moves through, the four rule types that cover almost every situation, a working configuration to start from, and how to build it through the console and through Terraform.

The storage-class ladder and what each tier costs you

Before writing a single rule, it helps to know exactly where the data is going, because a lifecycle policy that ships an object to the wrong tier can cost more than doing nothing. Every transition is a trade between what storage costs monthly and how fast (or easily) that data can be pulled back. Get that trade wrong and the rule doesn't erase a cost, it just invents a new one.

The ladder only runs one direction. Objects move to colder, cheaper tiers through lifecycle rules, but they never move back up on their own. Pulling something back to a warmer tier means running an explicit copy or restore operation, and for anything at Glacier or below, that restore step comes first. Treat every transition as a one-way door, because that's what it is.

The ladder itself is priced for US East, N. Virginia. Standard is the default tier, with millisecond access, and the highest cost of the group. Standard-IA offers the same millisecond access but adds a per-retrieval fee and a minimum 30-day storage charge. One Zone-IA costs less than Standard-IA and works for non-critical, infrequently accessed data, with the tradeoff that it lives in a single availability zone instead of being spread across several. Glacier Instant Retrieval keeps millisecond retrieval speed, but it prices at archive rates. Glacier Flexible Retrieval costs less than Glacier Instant Retrieval, in exchange for a retrieval window measured in minutes to hours rather than milliseconds. Glacier Deep Archive is the cheapest option available at the bottom of the ladder, with a retrieval window that can run up to two days.

Three rules govern how fast data can move down that ladder. Objects have to sit in Standard for a minimum of 30 days before they're eligible to transition into Standard-IA. A similar minimum holding period applies before an object can move out of Standard-IA and into Glacier. Objects under 128 KB don't transition by default, and the IA and Glacier Instant Retrieval classes bill anything smaller than 128 KB as if it were a full 128 KB object, so shipping a pile of tiny files down the ladder can cost more than just leaving them in Standard.

Retrieval fees deserve their own warning. IA and Glacier tiers charge every time an object gets pulled back out, so if a dataset gets accessed often after it transitions, those retrieval charges can eat the entire storage saving and leave the policy worse than useless. S3 Intelligent-Tiering exists for exactly the case where access patterns can't be predicted in advance, and it charges a small monitoring fee per object to handle that uncertainty automatically. For data with a known, time-based access curve, explicit lifecycle rules beat Intelligent-Tiering on cost, because they skip the monitoring fee entirely. Whether to use fixed rules or Intelligent-Tiering comes down to one question: is the access pattern predictable, or not?

The four rule types that cover nearly every lifecycle need

Once the storage tiers make sense, the next question is what a lifecycle rule can actually tell S3 to do. Nearly every configuration problem reduces to four rule types, and most misconfigured buckets suffer from the same mistake: a team sets up the first type and stops there, never adding the rest.

Transition rules move objects into a cheaper storage class after a set number of days. Every day count in a transition rule is measured from the object's creation date, never from the date of its last transition, which matters a lot once a rule chains several storage classes together.

Expiration rules permanently delete objects once they hit a defined age. These fit temporary files, session data, build artifacts, and anything with a retention clock that eventually runs out.

Noncurrent-version rules act on old versions in a versioned bucket, the copies that get created every time someone overwrites or deletes a file. Skipping this rule type lets old versions pile up quietly in the background, often tripling the storage bill without a single new file ever being uploaded. Noncurrent-version transitions move those older copies to cheaper tiers, while noncurrent-version expiration deletes them outright after a set number of days. A parameter called NewerNoncurrentVersions lets a rule keep a fixed number of recent historical versions around and clear out everything older than that, which is handy for teams that want a safety net without an unlimited archive.

Abort-incomplete-multipart-upload rules clean up the leftover pieces of multipart uploads that never finished. Anything larger than 100 MB typically uploads in parts, and a dropped connection, a crashed client, or a CI job that got killed mid-run leaves those parts sitting in the bucket. They don't show up in a normal object listing, so they're easy to miss, and storage charges accrue in the bucket the entire time nobody notices them.

Almost every lifecycle configuration problem reduces to these four rule types, and most teams misconfigure their buckets because they deploy only the first one and forget the rest. A rule can target every object in a bucket, objects under a specific prefix, objects carrying a specific tag, or a prefix-and-tag combination joined by an "and" block.

One more constraint, recent as of 2026: S3 Lifecycle now blocks expiration and transition actions on any object whose replication status reads PENDING or FAILED. Lifecycle won't touch an object until it has successfully replicated to its destination bucket, which matters for any bucket running cross-region replication alongside a lifecycle policy.

A canonical lifecycle configuration to use as a starting point

Diagram: How a Log File Descends the Storage Ladder Over Two Years. Visualizes: Show the one-way journey of a log file through S3 storage tiers as a horizontal timeline measured in days from creation.

Logs get queried constantly in the first 30 days, get pulled up occasionally for debugging over the next couple of months, then settle into reference-only status before eventually becoming a pure compliance record. That access curve maps directly onto the storage ladder: Standard for the first 30 days, Standard-IA for the following couple of months, Glacier Flexible Retrieval once the data is reference-only, Deep Archive after a year for compliance retention, and deletion once the defined retention horizon runs out.

Here's that pattern as an actual lifecycle configuration. A lifecycle configuration is built around a top-level Rules array, and each rule inside it carries an ID, a Status of Enabled or Disabled, a Filter, and one or more action blocks. A Filter that specifies a Prefix limits the rule to a single path, while leaving the Filter empty applies the rule to every object in the bucket. Stacking multiple Transition blocks inside a single rule drives the entire cascade down the ladder, and every day count in those blocks still measures from the object's creation date. An Expiration block with a Days value handles the final step, deleting the object once its retention horizon runs out.

{
 "Rules": [
 {
 "ID": "log-lifecycle-canonical",
 "Status": "Enabled",
 "Filter": { "Prefix": "logs/" },
 "Transitions": [
 { "Days": 30, "StorageClass": "STANDARD_IA" },
 { "Days": 90, "StorageClass": "GLACIER" },
 { "Days": 365, "StorageClass": "DEEP_ARCHIVE" }
 ],
 "Expiration": { "Days": 730 }
 },
 {
 "ID": "abort-incomplete-multipart",
 "Status": "Enabled",
 "Filter": {},
 "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 }
 }
 ]
}

Apply this through the CLI with aws s3api put-bucket-lifecycle-configuration --bucket <name> --lifecycle-configuration file://lifecycle.json. Once it's applied, give it time. Lifecycle configurations can take a day or two to complete their first pass and start actually migrating older objects, so check the bucket's Management tab to confirm the rule is active rather than assuming it worked instantly.

Configuring lifecycle policies through the AWS Console step by step

The console is the fastest route to a working rule on a single bucket, and it's also the best way to confirm that a policy written in code actually took effect. Before clicking anything, confirm the IAM user or role in use carries both s3:GetLifecycleConfiguration and s3:PutLifecycleConfiguration permissions. Without those two permissions, the console will simply refuse to save anything, often without a clear explanation of why.

Test on a throwaway bucket first. Create one, drop in a handful of dummy objects, and run the rule against that before ever pointing a new configuration at production data. A misconfigured expiration rule on a live bucket is the kind of mistake that only announces itself after the data is already gone.

From there, the path through the console runs: S3 dashboard, then the target bucket, then the Management tab, then Lifecycle rules, then Create lifecycle rule. Inside that rule, choose the scope: apply it to every object in the bucket, or narrow it down by prefix, by tag, or by both together. For the transition step, pick a storage class and set the number of days from object creation. The console displays a summary of the transition before anything saves, which is worth reading carefully since it's the last chance to catch a typo in the day count. For expiration, set the number of days the same way, and on a versioned bucket, separate fields appear for noncurrent-version transitions and noncurrent-version expiration, since those need their own schedules apart from the current version of each object.

After saving, go back to the Management tab and confirm the rule shows a status of Enabled. That's the entire verification step. If the status reads anything else, the rule isn't running, no matter how correctly the days and storage classes were set up.

Managing lifecycle rules as Terraform code

The console is fine for one bucket and a quick check. It doesn't scale past that. A policy clicked into place by hand on bucket after bucket will drift over time as rules get tweaked inconsistently, while a policy defined in Terraform gets enforced the same way on every single apply. That consistency is the actual argument for managing lifecycle rules as code once a team has more than a couple of buckets to think about.

One detail trips up a lot of older configurations: since AWS provider v4, lifecycle rules live in their own resource, aws_s3_bucket_lifecycle_configuration, rather than as an inline block inside aws_s3_bucket. Terraform configs written before that change, or copied from an old tutorial, will fail or behave strangely until they're updated to the separate resource.

Each bucket should have exactly one aws_s3_bucket_lifecycle_configuration resource, referencing the bucket by ID, with multiple rule blocks nested inside that single resource rather than spread across several resources. Creating a second lifecycle configuration resource pointed at the same bucket doesn't add to the first, it overwrites it. Inside each rule block, expect an id, a status set to "Enabled", an optional filter, and one or more transition or expiration blocks, with day counts inside those transition blocks still counting from the object's creation date, not from whatever the previous transition step was.

Versioned buckets add a wrinkle. Use depends_on = [aws_s3_bucket_versioning.<name>] to guarantee versioning gets enabled before Terraform tries to apply the lifecycle rules on top of it. noncurrent_version_transition blocks handle moving old versions down the storage ladder, and noncurrent_version_expiration deletes them after a set number of days. Leave that expiration block out and old versions accumulate without limit, the exact silent cost problem a lifecycle policy exists to prevent.

Every bucket's configuration should also include an abort_incomplete_multipart_upload block with days_after_initiation set to 7, cleaning up abandoned upload parts before they turn into a recurring, invisible charge. For tag-based targeting, a filter block with a tag key and value, for example filter { tag { key = "DataType" value = "compliance" } }, narrows a rule to only the objects carrying that tag, and combining a prefix with a tag just means wrapping both inside an and block.

Written this way, the entire log-lifecycle pattern from earlier, transitions, expiration, multipart cleanup, and versioning rules together, becomes a single reviewable file that applies the same way across every bucket a team manages, instead of a setting someone configured once by hand and never looked at again.

This article is sponsored by Archil.

Sources

  1. Amazon S3 - Lifecycle Management - GeeksforGeeks
  2. Examples of S3 Lifecycle configurations - Amazon Simple Storage Service
  3. Managing the lifecycle of objects - Amazon Simple Storage Service

More in S3 Bucket Fundamentals