Help Center/ Object Storage Service/ Tools Guide/ obsutil/ Bucket Commands/ Obtaining the Lifecycle Configuration of a Bucket
Updated on 2026-09-20 GMT+08:00

Obtaining the Lifecycle Configuration of a Bucket

Function

You can use this command to obtain the lifecycle configuration of a bucket.

Command Line Structure

  • Windows
    obsutil lifecycle obs://bucket -method=get  [-localfile=xxx] [-config=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-e=xxx] 
  • macOS or Linux
    ./obsutil lifecycle obs://bucket -method=get  [-localfile=xxx] [-config=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-e=xxx] 

Examples

  • In Windows, run obsutil lifecycle obs://bucket -method=get -localfile=d:\temp\lifecycle.xml to export the lifecycle configuration of bucket bucket to the local file lifecycle.json.
    obsutil lifecycle obs://bucket -method=get -localfile=d:\temp\lifecycle.xml
    
    Start at 2024-09-30 08:08:59.9412332 +0000 UTC
    
    Export lifecycle rules to [d:\temp\lifecycle.json] succeed, requestId is [00000195D6546E804019204E29C1B8D8]

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

The bucket name

method

Mandatory

The method. Set this parameter to get when obtaining the lifecycle configuration of a bucket.

localfile

Optional (additional parameter)

The local file to which the lifecycle configuration is exported. If this parameter is not specified, the configuration defaults to standard output.

bucket-cname

Optional (additional parameter)

The user-defined domain name bound to the bucket

NOTE:

This parameter is only supported by obsutil 5.7.9 and later.

config

Optional (additional parameter)

The user-defined configuration file for executing the current command. For details about parameters that can be configured, see Configuration Parameters.

e

Optional (additional parameter)

The endpoint

i

Optional (additional parameter)

The user's AK

k

Optional (additional parameter)

The user's SK

t

Optional (additional parameter)

The user's security token