{{ result.summary.heading }}
{{ result.summary.primary }}
{{ result.summary.line }}
{{ badge.label }}
{{ marker.label }}
S3 lifecycle policy generator inputs
Start from a realistic pattern, then tune the filters and retention days before copying the policy.
Use the bucket that will receive the generated lifecycle configuration.
Keep this stable so reviews and AWS console history remain understandable.
Choose general purpose unless this is an S3 Express One Zone directory bucket.
Use Disabled when you want to stage a reviewed configuration before activation.
Use a trailing slash for folder-like prefixes such as logs/app/ or tmp/.
Each listed tag must exist on an object for the rule to apply.
{{ result.filterSummary }}
List ordered current-version transitions. Leave blank for expiration-only cleanup.
Expiration is destructive; keep it later than the final transition day.
days
Select whether the output should include noncurrent-version transition and expiration actions.
Use this for rollback-safe archives of overwritten versions.
Keep newer noncurrent versions when accidental overwrite recovery matters.
days
This threshold protects the most recent overwritten versions.
versions
Set days to 0 to omit multipart cleanup.
days after initiation
Use 128 KB or larger for most transition rules unless small-object transition cost is intentional.
KB
Leave blank for no upper size bound.
KB
Only emitted when there is no current-object expiration and no tag filter conflict.
Leave blank when the deployment workflow supplies this separately.
Use the bucket's region for CLI snippets.
Use a PascalCase logical ID when pasting into a larger template.
Use lower-case snake_case for clean Terraform references.
Use a compact value for screenshots or a larger value for handoff reviews.
rows
Adds short comments to XML, Terraform, and CLI outputs without changing the AWS lifecycle JSON payload.
{{ header }} Copy
{{ cell }}
No rows for the current lifecycle input.
Lifecycle timeline renderer unavailable.
Customize
Advanced
:

Introduction:

Amazon S3 lifecycle rules turn storage retention decisions into automatic actions. Instead of keeping every object in the same storage class forever, a bucket can transition older objects to an archive class, delete temporary files after a short period, clean old noncurrent versions, or abort incomplete multipart uploads that would otherwise leave unused parts behind.

The core idea is simple: a rule chooses a set of objects and then applies one or more actions as those objects age. The details matter because lifecycle actions can move data into classes with retrieval costs, minimum storage durations, or delayed access, and expiration can permanently remove current objects or old versions. A rule that is useful for access logs may be dangerous for legal records, backups, active data lake partitions, or files protected by a retention process outside S3.

Timeline diagram of S3 lifecycle filtering, transition, archive, expiration, noncurrent cleanup, and multipart cleanup concepts.

Filters define scope. A lifecycle rule can apply to a whole bucket, a key prefix such as logs/app/, one or more object tags, and object-size boundaries. Combining filters is powerful, but it also makes review harder. A whole-bucket expiration rule may remove more than intended; a tag-filtered rule may miss objects that were uploaded without the expected tags.

Versioning changes the meaning of deletion. In a nonversioned bucket, current-object expiration removes the object. In a versioned or versioning-suspended bucket, noncurrent version actions can transition or delete older versions while the current object remains. Retaining a number of newer noncurrent versions adds a second threshold: old versions are not affected until both the age and retained-version conditions are met.

S3 lifecycle action types and review cautions
Action What it affects Review caution
Current transition Current objects after a chosen number of days. Storage class minimums and retrieval expectations can change cost.
Current expiration Current matching objects. Deletion can be permanent unless other retention controls exist.
Noncurrent transition Older object versions in versioned buckets. Only applies when versioning is enabled or suspended.
Noncurrent expiration Old noncurrent versions past age and retained-version thresholds. Can remove rollback points needed for recovery.
Multipart cleanup Incomplete multipart uploads after initiation age. Cannot be combined with tag filters in the same S3 lifecycle rule.

Lifecycle policy design should therefore start with ownership and recovery questions, not syntax. Decide who owns the data, how long it must remain recoverable, what storage class tradeoffs are acceptable, and how the rule will be merged with any existing bucket lifecycle configuration.

How to Use This Tool:

Choose a lifecycle posture, tune the filter and age thresholds, then inspect every generated artifact before applying anything to a bucket.

  1. Select a Lifecycle preset such as logs archive, temporary expiration, data lake archive, noncurrent version cleanup, multipart cleanup, or directory bucket expiration.
  2. Enter Bucket name, Rule ID, Bucket type, and rule status. Directory bucket mode omits unsupported transitions, tag filters, and versioned-object actions.
  3. Set the lifecycle filter with Prefix, tag filters, and optional object-size boundaries. Use whole-bucket scope only when that is intentional.
  4. Add current-object transitions as CSV rows of days, storage class, and note. Then set current expiration days if the rule should delete current objects.
  5. Choose the versioning posture and set noncurrent transition, noncurrent expiration, newer noncurrent versions to retain, and abort-incomplete-multipart days as needed.
  6. Use Advanced options for expected bucket owner, region, CloudFormation logical ID, Terraform resource name, visible row limit, and review comments in code artifacts.
  7. Review Lifecycle JSON, XML, CloudFormation, Terraform, AWS CLI, Rule Ledger, Review Checks, and Lifecycle Timeline. Blocking input issues should be fixed before copying output.

Interpreting Results:

The Lifecycle JSON tab is the main S3 API shape. Other code tabs translate the same normalized model into XML, CloudFormation, Terraform, and AWS CLI examples. The Rule Ledger is the best place to review scope and timing because it lists each rule, stage, action, day or threshold, storage class, and review note in table form.

  • Blocking input issues mean the generated lifecycle configuration should not be used until the input is corrected.
  • Review notes flag choices that may be valid but need owner approval, such as destructive expiration or small-object transition behavior.
  • Companion multipart rules appear when tag filters would make an abort-incomplete-multipart action invalid in the same rule.
  • Lifecycle Timeline visualizes day-based actions, but legal retention, backup ownership, and retrieval needs must be checked outside the chart.

Technical Details:

S3 lifecycle configuration is a list of rules. Each rule has an ID, a status, a filter, and zero or more actions. The filter can be a prefix, a single tag, an And combination of prefix, tags, and size constraints, or a bucket-wide scope. The status value controls whether S3 performs the actions after the configuration is applied.

Current-object actions use creation age. Noncurrent-version actions use the time since an object version became noncurrent, and optional newer-version retention can delay action until enough newer noncurrent versions exist. Multipart cleanup uses days after multipart upload initiation, not object age.

Rule Core:

S3 lifecycle rule construction logic
Condition Rule behavior Generated warning or issue
No lifecycle action selected No useful rule can be generated. Blocking issue asks for at least one action.
Transition day before storage-class minimum Transition is rejected for that storage class. Blocking issue names the minimum day.
Expiration before or at final transition day Object would expire before the final transition has value. Blocking issue asks for later expiration.
Expiration before minimum storage duration ends The policy may create early deletion charges. Review note suggests a later expiration day.
Directory bucket selected Transitions, tag filters, and versioned-object actions are omitted. Review notes explain the omissions.

Object-size filters in S3 are exclusive byte comparisons. The interface accepts inclusive kilobyte boundaries for readability, then converts them to exclusive byte values in the generated filter.

ObjectSizeGreaterThan = minimum KB × 1024 - 1

A visible minimum of 128 KB therefore emits an exclusive byte threshold of 131071. Objects larger than 131071 bytes match the filter, which is the inclusive 128 KB intention expressed in S3's exclusive operator.

Artifact Equivalence:

The JSON, XML, CloudFormation, Terraform, and CLI outputs represent the same lifecycle model as closely as each format allows. The CLI example writes the lifecycle JSON to a file and uses put-bucket-lifecycle-configuration, which replaces the bucket lifecycle configuration. Existing bucket rules should be merged deliberately before applying generated output.

Limitations:

Lifecycle output can delete or archive production data. Treat generated policies as review artifacts until they have been checked against account policy, bucket versioning, Object Lock, backup requirements, and workload retrieval expectations.

  • The generated AWS CLI command can replace an existing lifecycle configuration unless rules are merged first.
  • Storage-class costs, retrieval times, and minimum-duration charges can change after the policy is written.
  • Directory bucket support differs from general purpose bucket support, and unsupported actions are intentionally omitted.

Worked Examples:

A logs bucket can use the logs archive preset with prefix logs/app/, tags such as environment=prod, current transitions at 30 and 90 days, and expiration at 365 days. The Rule Ledger should show transition rows followed by current-object expiration, and Review Checks should call out destructive deletion for owner approval.

A versioned documents bucket can set current expiration to 0, keep noncurrent transition at 30 days, noncurrent expiration at 365 days, and retain 5 newer noncurrent versions. The resulting noncurrent version rows should be reviewed with rollback and restore requirements before use.

If tag filters are present and abort-incomplete-multipart cleanup is enabled, a companion rule is generated without tag filters. This is expected because S3 does not allow abort-incomplete-multipart cleanup with tag filters in the same lifecycle rule.

FAQ:

Does the generated policy include the bucket name?

The lifecycle JSON itself does not include the bucket name. Bucket name appears in command and infrastructure examples where that format needs it.

Why are transitions omitted for directory buckets?

Directory bucket lifecycle support is narrower, so the generator omits transitions, tag filters, and versioned-object actions when directory bucket mode is selected.

Why did I get an early deletion charge warning?

The final expiration day may be too close to the last transition for the selected storage class. Review the suggested later day before applying the rule.

What should I do with blocking input issues?

Fix the listed fields before copying artifacts. Common causes include invalid bucket names, invalid tag rows, transition timing conflicts, or no lifecycle action selected.

Glossary:

Lifecycle rule
An S3 configuration entry that applies actions to objects matched by a filter.
Prefix filter
A rule scope that matches object keys beginning with a selected string.
Noncurrent version
An older object version that is no longer the current version in a versioned bucket.
Transition
A lifecycle action that moves matching objects or versions to another storage class.
Expiration
A lifecycle action that deletes current objects or old noncurrent versions after a threshold.

References: