Skip to main content
A bucket lifecycle policy is a set of rules that tells CoreWeave AI Object Storage to automatically delete objects, expire old object versions, or abort incomplete multipart uploads on a schedule you define. Lifecycle policies are the most reliable way to keep storage costs predictable, prevent unbounded growth from forgotten data, and unblock bucket deletion when incomplete multipart uploads accumulate. A lifecycle configuration is a JSON document with one or more rules. Each rule has a filter that selects which objects it applies to and one or more actions that run when an object matches the filter and reaches the rule’s age threshold.

Supported actions

AI Object Storage supports the following lifecycle actions:
  • Expiration: Delete current object versions when they reach a given age, on a specific date, or after they become an expired delete marker.
  • NoncurrentVersionExpiration: For versioned buckets, delete noncurrent object versions when they reach a given age. Optionally retain a fixed number of newer noncurrent versions.
  • AbortIncompleteMultipartUpload: Permanently abort multipart uploads that have not completed within a given number of days after initiation, removing all uploaded parts.
Transition actions, which move objects between storage classes, are not supported. AI Object Storage manages storage tiering automatically based on access patterns. See Cost management for details.

Key behaviors

Read these behaviors before designing a lifecycle policy.
Lifecycle rules ignore Deny statements in bucket and organization access policies.Lifecycle deletions run as a privileged service action and are not evaluated against the bucket access policy or organization access policy. A Deny statement on s3:DeleteObject does not prevent a lifecycle rule from deleting matching objects. Treat the lifecycle configuration itself as the access boundary for automated deletions, and protect bucket retention by controlling who can call s3:PutBucketLifecycleConfiguration.
  • Object age is measured from creation time, not last access time. A Days: 7 rule deletes an object 7 days after it was uploaded, regardless of how recently it was read. To target objects by access pattern, use the tier-based pricing model instead.
  • Eligibility is evaluated at UTC midnight day boundaries; once eligible, objects are processed within roughly an hour. Eligibility is calculated by truncating creationTime + Days to midnight UTC. A Days: 7 rule on an object uploaded at 14:00 UTC on day 1 makes it eligible at midnight UTC on day 8. The lifecycle processor runs approximately every hour — once the midnight UTC eligibility date has passed, the object is processed in the next hourly run. Storage fees continue to accrue until the physical deletion completes.
  • Versioning interacts with Expiration. On a versioning-enabled bucket, an Expiration rule does not permanently delete objects — it writes a delete marker, making the current version noncurrent. On a versioning-suspended bucket, expiration creates a delete marker with a null version ID; if the current version already has a null version ID, it is permanently replaced. To permanently remove data in either case, also configure NoncurrentVersionExpiration.
  • Putting a configuration replaces the existing one. s3:PutBucketLifecycleConfiguration overwrites the entire lifecycle configuration for a bucket. Always send the full set of rules you want enforced.
  • Each bucket can have up to 1,000 lifecycle rules. See Manage quotas and limits for the full limits table.
  • Disabling or deleting a rule unschedules pending expirations. If a rule is disabled or removed, objects that were already queued for expiration are unscheduled and are not deleted.
  • When multiple rules match the same object on the same day, the most aggressive action wins. Permanent deletion takes precedence over creating a delete marker. If two expiration rules overlap, the shorter expiration period is applied. When a broad rule (empty prefix) and a narrower rule (specific prefix) both match, both run independently.

Rule filters

A rule’s Filter selects which objects the rule applies to. A rule with an empty filter applies to every object in the bucket.

Prefix filter

A prefix filter applies the rule to objects whose keys start with the given prefix. Use prefix filters to scope rules to a folder-like portion of a bucket.
Apply only to objects under the logs/ prefix
{
  "Rules": [
    {
      "ID": "ExpireLogsAfter30Days",
      "Filter": {
        "Prefix": "logs/"
      },
      "Status": "Enabled",
      "Expiration": {
        "Days": 30
      }
    }
  ]
}

Tag filter

A tag filter applies the rule to objects that carry a specific object tag. Use tag filters when objects you want to expire are not grouped by key prefix.
Apply only to objects tagged temp=true
{
  "Rules": [
    {
      "ID": "ExpireTaggedTemporaryObjects",
      "Filter": {
        "Tag": {
          "Key": "temp",
          "Value": "true"
        }
      },
      "Status": "Enabled",
      "Expiration": {
        "Days": 7
      }
    }
  ]
}
To match objects that have all of multiple tags, wrap the tags in And. Objects with additional tags beyond those listed still match.
Apply only to objects tagged environment=dev AND team=ml-training
{
  "Filter": {
    "And": {
      "Tags": [
        { "Key": "environment", "Value": "dev" },
        { "Key": "team", "Value": "ml-training" }
      ]
    }
  }
}

Size filter

A size filter matches objects whose size falls within a specified range. Both boundaries are exclusive — objects exactly at the boundary value are not matched. Values are in bytes.
Apply only to objects larger than 1 MB and smaller than 100 MB
{
  "Filter": {
    "ObjectSizeGreaterThan": 1048576,
    "ObjectSizeLessThan": 104857600
  }
}
Size constraints can be combined with a prefix and tags using And. See Combined filter below.

Combined filter

A rule can combine a prefix, multiple tags, and object size constraints by wrapping them in And.
Apply to large objects under archive/ tagged class=cold
{
  "Rules": [
    {
      "ID": "ExpireLargeColdArchives",
      "Filter": {
        "And": {
          "Prefix": "archive/",
          "Tags": [
            { "Key": "class", "Value": "cold" }
          ],
          "ObjectSizeGreaterThan": 1048576
        }
      },
      "Status": "Enabled",
      "Expiration": {
        "Days": 90
      }
    }
  ]
}

Common configurations

The following configurations cover the most common use cases. Each configuration is a complete, valid lifecycle document you can apply to a bucket as is.
This configuration expires every object in the bucket 7 days after it is uploaded.
Expire all objects 7 days after creation
{
  "Rules": [
    {
      "ID": "ExpireObjectsAfter7Days",
      "Filter": {},
      "Status": "Enabled",
      "Expiration": {
        "Days": 7
      }
    }
  ]
}
You can combine multiple rules in one configuration. A single configuration that applies all three of the preceding patterns at once would include three entries in the Rules array.

Apply a lifecycle configuration

Save the lifecycle configuration to a file, then apply it to your bucket using one of the following clients.
  1. Save the configuration to a local file, for example lifecycle.json.
  2. Apply the configuration. Replace [BUCKET-NAME] with the name of your bucket.
    Apply a lifecycle configuration with AWS CLI
    aws s3api put-bucket-lifecycle-configuration \
        --bucket [BUCKET-NAME] \
        --lifecycle-configuration file://lifecycle.json
    

Verify a lifecycle configuration

Confirm the active configuration on a bucket. To check when a specific object will expire, use the HeadObject (AWS CLI: head-object) or GetObject API — the response includes an x-amz-expiration header with the expiration date and the rule ID that applies to the object.
Get the active lifecycle configuration with AWS CLI
aws s3api get-bucket-lifecycle-configuration --bucket [BUCKET-NAME]

Delete a lifecycle configuration

Removing the lifecycle configuration stops all automated lifecycle actions on the bucket. Objects that were already queued for expiration are unscheduled and are not deleted.
Delete the lifecycle configuration with AWS CLI
aws s3api delete-bucket-lifecycle --bucket [BUCKET-NAME]

Rule field reference

The following fields are available in a lifecycle rule:
FieldDescription
IDIdentifier for the rule. Up to 255 characters.
FilterSelects which objects the rule applies to. Contains a Prefix, Tag, or And clause. An empty filter matches every object in the bucket.
Filter.PrefixObject key prefix to match. For example, foo/ matches both foo/bar and foo/baz.
Filter.TagA single tag key/value pair to match.
Filter.AndCombines a prefix, multiple tags, and object size constraints in one filter.
Filter.ObjectSizeGreaterThanMinimum object size, in bytes.
Filter.ObjectSizeLessThanMaximum object size, in bytes.
StatusEnabled or Disabled. Disabled rules do not run.
ExpirationDeletes the current version of matching objects when they reach a given age (Days), on a specific UTC date in ISO 8601 format (Date), or when an expired delete marker is present (ExpiredObjectDeleteMarker).
Expiration.ExpiredObjectDeleteMarkerIf true, removes a delete marker that has no remaining noncurrent versions. Cannot be combined with Days or Date.
NoncurrentVersionExpirationOn versioned buckets, deletes noncurrent versions after NoncurrentDays. Optionally retains NewerNoncurrentVersions of the most recent noncurrent versions.
AbortIncompleteMultipartUploadAborts multipart uploads that have not completed DaysAfterInitiation days after they were started.

Common questions

Can I recover objects that were deleted by a lifecycle rule? In a non-versioned bucket, no — expired objects are permanently deleted. In a versioning-enabled bucket, an Expiration rule creates a delete marker rather than permanently deleting the object, so you can restore a previous version by copying it back as the current version. Enable versioning before configuring expiration rules if you need recoverability. Can I use multiple prefixes in a single rule? No. A single lifecycle rule supports only one prefix. To apply the same action to objects under multiple prefixes, either create a separate rule for each prefix, or use object tags to group objects under a tag-based filter. Can I exclude a prefix from a lifecycle rule? Lifecycle rules do not support exclusion filters. Use object tags to mark the objects you want to include, then create a tag-based rule that targets them rather than trying to exclude objects by prefix. Do lifecycle rules apply to objects that already exist in the bucket? Yes. When you add or update a lifecycle configuration, rules apply to both existing and newly created objects. Existing objects that already meet the expiration criteria are queued for removal immediately. What happens when I update a lifecycle configuration? PutBucketLifecycleConfiguration replaces the entire existing configuration. To add or modify a single rule, retrieve the current configuration first, make your changes, and then put the updated configuration back.
Last modified on June 8, 2026