Bucket Lifecycle Policy


A bucket lifecycle policy is an S3 lifecycle rule on an Object Bucket: it deletes objects, or moves them to another storage class, once they reach a given age. This page covers creating, modifying, viewing and deleting those rules from QuantaStor.

What a lifecycle rule does

Each rule QuantaStor manages is one S3 lifecycle rule with three parts:

  • a filter that picks the objects -- a key prefix, a minimum size, a maximum size, or any combination; an empty filter selects every object in the bucket,
  • a transition, which moves matching objects to another storage class a number of days after they were written, and
  • an expiration, which deletes matching objects a number of days after they were written.

A transition to a cloud-tier storage class is how objects are tiered from the local cluster to AWS S3, S3 Glacier or another S3 provider; see Object Storage Classes and Cloud Tiering for the full workflow. A transition to a pool-backed class moves objects between local data pools, for example from flash to high-capacity disk.

QuantaStor writes the whole rule set of the bucket to the object gateway through the S3 PutBucketLifecycleConfiguration call, using the bucket owner's key, and saves the rule only after the gateway has accepted it. Deleting the last rule removes the bucket's lifecycle configuration. The gateway then processes the rules in the background, so an object is transitioned or expired some time after it reaches the rule's age rather than at that exact moment.

Rules that an S3 client put on the bucket directly are picked up by the bucket scan and listed alongside the ones created in QuantaStor. Modifying such a rule in QuantaStor rewrites it with the fields described on this page, so any other settings it carried are dropped.

Creating a rule

Navigation: Storage Management → Object Buckets (section) → search, then select a bucket → Bucket Lifecycle Policies (toolbar group) → Create
 
Create Bucket Lifecycle Policy with a transition to a cloud-tier storage class after 30 days.

Search for buckets in the Object Buckets view and select the one the rule is for; the dialog opens with it filled in. You can also pick a bucket in the dialog with Search....

Field Default Notes
Bucket the selected bucket The bucket the rule is added to. Search... finds a different one.
Name (Rule Id) generated, for example bucket-lifecycle-policy-1 The rule's name. It must be unique within the bucket; the same Rule Id may be used on other buckets.
Enabled selected A disabled rule stays on the bucket but is not acted on.
Prefix (Filter) empty Only objects whose key starts with this prefix. Empty matches every key.
Min Size (Filter) 0 Only objects larger than this. 0 means no lower limit.
Max Size (Filter) 0 Only objects smaller than this. 0 means no upper limit.
Expiration / Transition Expiration Chooses which of the two sections below the rule uses. The dialog creates one action per rule; the CLI can set both on one rule.
Expiration Days 30 1 to 3650. Matching objects are deleted this many days after they were written.
Transition Days 30 1 to 365. Matching objects move to the storage class below this many days after they were written.
Storage Class pre-selected Required for a transition. The dialog pre-selects one of the non-STANDARD classes, so check it before clicking OK. The class the objects move to -- a pool-backed class or a cloud-tier class on the bucket's Ceph cluster.

The transition storage class must exist on the bucket's Ceph cluster; any other name is refused with a list of the classes that do. A rule needs a transition, an expiration, or both.

To expire objects some time after they have been tiered, create two rules on the bucket -- a transition rule and a longer expiration rule -- or set both on one rule from the CLI.

Modifying a rule

Navigation: Storage Management → Object Buckets (section) → search, then select a bucket → Bucket Lifecycle Policies (toolbar group) → Modify

Choose the rule in Lifecycle Policy Rule. Every other field is the same as in the create dialog. The Name (Rule Id) cannot be changed; to rename a rule, create a new one and delete the old one.

Viewing rules

Navigation: Storage Management → Object Buckets (section) → search, then select a bucket → Bucket Lifecycle Policies (toolbar group) → View
 
View Bucket Lifecycle Policies, listing the rules on the selected bucket.

The dialog lists the rules of the selected bucket and shows each rule as the Rules JSON sent to the gateway. The list comes from the bucket scan, so run Rescan Object Storage Buckets with Deep Scan and Enable Life Cycle Updates selected first; otherwise rules added by an S3 client, or changed outside QuantaStor, do not appear.

Deleting rules

Navigation: Storage Management → Object Buckets (section) → search, then select a bucket → Bucket Lifecycle Policies (toolbar group) → Multi-Delete

Select the bucket, tick one or more rules, and confirm. Deleting a rule stops future transitions and expirations; objects that have already moved stay in the class they moved to.

A rule that transitions to a storage class also blocks that class from being deleted until the rule is removed or the class delete is forced; see Deleting a storage class.

Managing rules from the CLI

The --lifecycle-policy argument takes the rule's UUID, or its Rule Id. A Rule Id is only unique within a bucket, so add --bucket when the same Rule Id is used on more than one bucket; the command reports the matching buckets if it cannot tell which one you mean.

Command Purpose
qs bucket-lifecycle-policy-create Add a rule to --bucket, with --rule-id and the filter, transition and expiration arguments
qs bucket-lifecycle-policy-modify Change a rule
qs bucket-lifecycle-policy-get Show one rule
qs bucket-lifecycle-policy-list List rules, optionally for one --bucket or --ceph-cluster
qs bucket-lifecycle-policy-delete Delete a rule

Sizes are in bytes, and 0 leaves a filter or an action unset.

qs bucket-lifecycle-policy-create --bucket=media --rule-id=logs-to-cloud --prefix=logs/ --min-size=1048576 --transition-days=30 --transition-storage-class=AWS_IA --expiration-days=365
qs bucket-lifecycle-policy-modify --lifecycle-policy=logs-to-cloud --bucket=media --rule-status-enabled=false
qs bucket-lifecycle-policy-list --bucket=media
qs bucket-lifecycle-policy-delete --lifecycle-policy=logs-to-cloud --bucket=media

Related pages


Verified against QuantaStor 6.9.0.