For the complete documentation index, see llms.txt. This page is also available as Markdown.

Manage S3 lifecycle rules using the CLI

This page describes how to manage information lifecycle (ILM) rules for S3 buckets using the CLI.

Using the CLI, you can:

In multi-tenant deployments, lifecycle rules are scoped to the tenant in which they are defined. Rules apply only to buckets owned by that tenant. The lifecycle crawler runs cluster-wide across all tenants automatically. No additional configuration is required per tenant.

Add a lifecycle rule

Command: weka s3 bucket lifecycle-rule add

Use the following command line to add a lifecycle rule:

weka s3 bucket lifecycle-rule add <bucket> <expiry-days> [--noncurrent] [--prefix prefix] [--tags tags]

Parameters

Name
Value

bucket*

The S3 bucket name.

expiry-days*

The minimum number of days before the object is eligible for expiration. ILM processes the object shortly after this period based on its modified timestamp, but processing may be delayed if the queue is long. Minimum: 1 day

noncurrent

Apply the expiry to noncurrent object versions only, leaving the current version of each object in place.

prefix

The object prefix to which the rule applies.

Wildcards are not supported.

tags

Key value pair of object tags to apply the rule to. Pairs of key values: '<k1>=<v1>&<k2=<v2>'

Expire noncurrent object versions

A versioned bucket retains every earlier version of an object. Those versions consume capacity until a lifecycle rule expires them, and no rule expires them by default.

A rule created with --noncurrent applies only to earlier versions and leaves the current version of each object in place. A rule created without it applies to current versions.

Two alerts identify a versioned bucket that lacks this cleanup:

Alert
Meaning

S3VersioningNoNoncurrentExpirationRule

The bucket uses versioning but has no noncurrent version expiration rule.

S3VersioningNoDataservIlm

The bucket uses versioning, but no active Data Services container has lifecycle management configured.

Example: expire noncurrent versions after 30 days

  1. Enable the S3 lifecycle task manager.

  2. Add the rule to the versioned bucket.

  3. Confirm the rule. The Noncurrent column reads true.

View lifecycle rules

Command: weka s3 bucket lifecycle-rule list‌

Use the following command line to view a bucket's existing lifecycle rules:‌

weka s3 bucket lifecycle-rule list <bucket>‌

Parameters

Name
Value
Default

bucket*

The S3 bucket name.

​Content

Remove a lifecycle rule

Command: weka s3 bucket lifecycle-rule remove

Use the following command line to remove an lifecycle rule of a specified bucket:

weka s3 bucket lifecycle-rule remove <bucket> <name>

Parameters

Name
Value

bucket*

The S3 bucket name.

name*

The rule name.

Remove all lifecycle rules

Command: weka s3 bucket lifecycle-rule reset

Use the following command line to remove all the lifecycle rules of a specified bucket:

weka s3 bucket lifecycle-rule reset <bucket>

Parameters

Name
Value

bucket*

The S3 bucket name.

Last updated