Skip to main content
Last updated on

Bucket Lifecycle

Lifecycle Rules allow you to automate object management over time — automatically deleting old objects, removing old versions, or cleaning up incomplete uploads. This is an effective way to control storage costs without manual intervention.

Access the Lifecycle Configuration

Step 1: Go to Simple Storage → Buckets, then click the name of the bucket you want to configure.

Step 2: Open the Lifecycle Config tab in the bucket management section.

Lifecycle Config Tab - JSON Editor

Step 3: Click Apply templates to choose a pre-built rule template, or paste custom JSON directly into the editor.

Lifecycle Config Templates

Create a Lifecycle Rule

Each Lifecycle Rule consists of several configuration sections:

Part 1: Basic Information

  • Rule Name: Enter a descriptive name for easy identification, e.g., delete-logs-after-30-days, cleanup-tmp-uploads.

  • Status: Enable or disable the rule. Choose Enabled to apply the rule immediately.

  • Filter: Determine which objects the rule applies to:

    • Apply to all objects: Applies to all objects in the bucket
    • Prefix: Applies only to objects whose paths start with a specific prefix (e.g., logs/, tmp/uploads/)
    • Tag: Applies only to objects with a specific tag (e.g., type=temporary)

Part 2: Actions

Choose one or more automated actions:

Expiration (Object Expiration):

  • Expire current version after N days: Automatically deletes objects after N days from their creation date
  • Example: Automatically delete log files older than 90 days

Noncurrent Version Expiration:

  • Only applies when the bucket has Versioning enabled
  • Delete noncurrent versions after N days: Deletes non-current versions after N days
  • Keep only N most recent noncurrent versions: Retain only the N most recent old versions

Abort Incomplete Multipart Uploads:

  • Automatically aborts and cleans up interrupted multipart uploads after N days
  • Helps avoid accumulating "garbage" data from failed uploads

Delete expired object delete markers:

  • Only applies when Versioning is enabled
  • Cleans up delete markers that are no longer needed

Part 3: Timeframe

Enter the number of days for each action selected above. The minimum value is 1 day.

Step 4: Click Save Rule to save and apply.

Common Configuration Examples

Auto-delete log files after 30 days

FieldValue
Rule Namedelete-old-logs
FilterPrefix: logs/
ActionExpiration: 30 days

Clean up temp files

FieldValue
Rule Namecleanup-temp
FilterPrefix: tmp/
ActionExpiration: 7 days

Version management (combined with Versioning)

FieldValue
Rule Nameversion-management
FilterEntire bucket
Action 1Noncurrent versions: delete after 30 days
Action 2Keep only 3 most recent noncurrent versions

Clean up failed multipart uploads

FieldValue
Rule Nameabort-incomplete-uploads
FilterEntire bucket
ActionAbort incomplete multipart uploads after: 3 days

Manage Lifecycle Rules

On the Lifecycle page, all rules are listed. You can:

  • Enable/disable individual rules using the status toggle
  • Edit a rule by clicking Edit
  • Delete a rule by clicking Delete

Notes

Lifecycle Rules run at 00:00 UTC each day. An object created today is not deleted until the end of day N (calculated in UTC).

Deletions performed by Lifecycle Rules are permanent (cannot be recovered) unless the bucket has Versioning enabled. Test rules on a test bucket/prefix before applying them to important data.