# How to Configure Lifecycle Rules Spaces Object Storage is an S3-compatible service for storing and serving large amounts of data. The built-in Spaces CDN minimizes page load times, improves performance, and reduces bandwidth and infrastructure costs. [Lifecycle rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) 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`](#configure-lifecycle-rules-using-s3cmd). To configure lifecycle rules with the API, see [Configure a Bucket’s Lifecycle Rules](https://docs.digitalocean.com/reference/api/spaces/index.html.md#configure-a-buckets-lifecycle-rules). Alternatively, you can use AWS CLI to [configure lifecycle rules](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-lifecycle.html). ## Configure Lifecycle Rules Using `s3cmd` You can also configure lifecycle rules using `s3cmd`. Below are examples for [setting an expiration rule](#set-an-expiration-rule) for automatic deletion of objects and [removing incomplete multipart uploads](#remove-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: ```shell 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:: ```shell 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](https://docs.digitalocean.com/products/spaces/reference/s3cmd/index.html.md).