Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



lifecycle - Get or set lifecycle configuration for a bucket

lifecycle - Get or set lifecycle configuration for a bucket

Synopsis

gsutil lifecycle get url gsutil lifecycle set config-json-file url...

Description

The lifecycle command can be used to get or set lifecycle management policies for the given bucket(s). This command is supported for buckets only, not objects. For more information on object lifecycle management, please see the developer guide .

The lifecycle command has two sub-commands:

Get

Gets the lifecycle configuration for a given bucket. You can get the lifecycle configuration for only one bucket at a time. The output can be redirected into a file, edited and then updated via the set sub-command.

Set

Sets the lifecycle configuration on one or more buckets. The config-json-file specified on the command line should be a path to a local file containing the lifecycle congfiguration JSON document.

Examples

The following lifecycle configuration JSON document specifies that all objects in this bucket that are more than 365 days old will be deleted automatically:

{
  "rule":
  [
    {
      "action": {"type": "Delete"},
      "condition": {"age": 365}
    }
  ]
}

The following (empty) lifecycle configuration JSON document removes all lifecycle configuration for a bucket:

{}

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.