---
title: "ezgh objects buckets lifecycle put"
description: "Replace a bucket's lifecycle rules."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ezgh objects buckets lifecycle put

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh objects buckets lifecycle put <bucket> --file rules.json [--yes] [flags]
```

Replace every lifecycle rule of a bucket with those in a JSON file (- reads stdin), up to 100.

A rule has an id (left out: one is assigned), a status (enabled or disabled) and at least one of: expirationDays or expirationDate (midnight UTC), which delete objects, for the whole bucket or under a prefix; and abortIncompleteMultipartUploadDays (1 to 7), which removes unfinished multipart uploads. A bucket takes one rule that aborts uploads, and that rule takes no prefix.

On a bucket with versioning, noncurrentVersionExpirationDays deletes a version that many days after a newer one replaced it, and expiredObjectDeleteMarker (true, without expirationDays or expirationDate) removes a delete marker once it's the only version left of its key.

Objects are deleted within a day after they qualify, permanently. With a rule that deletes objects or versions, or an empty list, which removes every rule, it asks first on a terminal; `--yes` confirms otherwise.

Part of [`ezgh objects buckets lifecycle`](/cli/reference/objects-buckets-lifecycle).

## Examples

```sh
echo '{"rules":[{"id":"tmp","status":"enabled","prefix":"tmp/","expirationDays":30}]}' |
  ezgh objects buckets lifecycle put bkt_4k2m9x0a7qpe --file - --yes
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--file` | string |  | the rules, as &#123; "rules": \[...\] &#125; (- is stdin) |
| `--yes` | boolean |  | don't ask |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/objects-buckets-lifecycle-put/index.mdx
