All Products
Search
Document Center

Object Storage Service:get-bucket-lifecycle

Last Updated:Mar 20, 2026

Retrieves the lifecycle rules configured for a bucket.

Permissions

By default, only the bucket owner can query lifecycle rules. To grant other users access, attach a custom policy that includes the oss:GetBucketLifecycle permission. For details, see Attach a custom policy to a RAM user.

Synopsis

ossutil api get-bucket-lifecycle --bucket value [flags]

Parameters

ParameterTypeDescription
--bucketstringThe name of the bucket.

For more information, see Command-line options.

Examples

Query lifecycle rules of examplebucket:

ossutil api get-bucket-lifecycle --bucket examplebucket

Query lifecycle rules and format the output as JSON:

ossutil api get-bucket-lifecycle --bucket examplebucket --output-format json

Query lifecycle rules and format the output as YAML:

ossutil api get-bucket-lifecycle --bucket examplebucket --output-format yaml