How to Configure Lifecycle Rules

Spaces Object Storage is an S3-compatible object storage service. Spaces buckets let you store and serve large amounts of data, and the built-in CDN minimizes page load times and improves performance.


Lifecycle rules define automated actions for managing objects in a Space over time. You can configure and set lifecycle rules using the Spaces API, AWS CLI, or s3cmd.

To configure lifecycle rules with the API, see Configure a Bucket’s Lifecycle Rules. Alternatively, you can use AWS CLI to configure lifecycle rules.

Configure Lifecycle Rules Using s3cmd

You can also configure lifecycle rules using s3cmd. Below are examples for setting an expiration rule for automatic deletion of objects and removing incomplete multipart uploads after a set number of days.

Set an Expiration Rule

To automatically delete objects after a set number of days, run the following command, substituting your-space-name with the name of your Spaces bucket:

s3cmd expire --expiry-days=30 --expiry-prefix= s3://your-space-name

In this command, the lifecycle rule rule expires all objects in your specified Space 30 days after their creation.

Remove Incomplete Multipart Uploads

To automatically remove incomplete multipart uploads after a set number of days, run the following command, substituting your-space-name with the name of your Spaces bucket::

s3cmd expire --expiry-mpu-days=1 s3://your-space-name

This command prevents abandoned multipart uploads from consuming storage unnecessarily after 1 day.

For more details, see the s3cmd documentation.

In this article...