Skip to content

ezgh objects buckets lifecycle put

Replace a bucket's lifecycle rules.

Updated View as Markdown
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.

Examples

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 { “rules”: […] } (- is stdin)
--yes boolean don’t ask

This command also takes the global flags.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close