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:
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> [--prefix prefix] [--tags tags]
Parameters
bucket
*
Name of the S3 bucket.
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
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>'
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
bucket
*
The name of the S3 bucket.
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> <rule>
Parameters
bucket
*
The name of the S3 bucket.
rule
*
The ID of the rule to delete.
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
bucket
*
The name of the S3 bucket.
Last updated