A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/storage/docs/managing-lifecycles below:

Manage object lifecycles | Cloud Storage

Skip to main content Manage object lifecycles

Stay organized with collections Save and categorize content based on your preferences.

Overview Configuration samples

This page describes how to set Object Lifecycle Management on a bucket and how to view a bucket's current lifecycle configuration. Lifecycle configurations apply to all current and future objects in the bucket.

Required roles

To get the permissions that you need to set and manage Object Lifecycle Management for a bucket, ask your administrator to grant you the Storage Admin (roles/storage.admin) role on the bucket. This predefined role contains the permissions required to set and manage Object Lifecycle Management for a bucket. To see the exact permissions required, expand the Required permissions section:

Required permissions

You might also be able to get these permissions with custom roles.

For information about granting roles on buckets, see Set and manage IAM policies on buckets.

Set the lifecycle configuration for a bucket Warning: When you change your lifecycle configuration, Object Lifecycle Management may still perform actions based on the old configuration for up to 24 hours. For example, if you change an Age condition from 10 days to 20 days, an object that is 11 days old could be deleted by Object Lifecycle Management up to 24 hours later, based on the old configuration. Console
  1. In the Google Cloud console, go to the Cloud Storage Buckets page.

    Go to Buckets

  2. In the bucket list, find the bucket you want to enable, and click the bucket's name.

  3. Click the Lifecycle tab.

    The lifecycle rules page appears. From here you can edit or delete existing rules. To add a new rule:

  4. Click Add a rule.

  5. In the page that appears, specify a configuration.

    1. Select the action to take when an object meets the conditions.

    2. Click Continue.

    3. Select the conditions under which an action is taken.

    4. Click Continue.

    5. Click Create.

To learn how to get detailed error information about failed Cloud Storage operations in the Google Cloud console, see Troubleshooting.

Command line
  1. Create a JSON file with the lifecycle configuration rules you would like to apply. See configuration examples for sample JSON files.

  2. Use the gcloud storage buckets update command with the --lifecycle-file flag:

    gcloud storage buckets update gs://BUCKET_NAME --lifecycle-file=LIFECYCLE_CONFIG_FILE

    Where:

Client libraries C++

For more information, see the Cloud Storage C++ API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

C#

For more information, see the Cloud Storage C# API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

Go

For more information, see the Cloud Storage Go API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

Java

For more information, see the Cloud Storage Java API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

Node.js

For more information, see the Cloud Storage Node.js API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

PHP

For more information, see the Cloud Storage PHP API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

Python

For more information, see the Cloud Storage Python API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

Ruby

For more information, see the Cloud Storage Ruby API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

The following sample sets a lifecycle configuration on a bucket:

The following sample removes any existing lifecycle configuration from on a bucket:

Terraform

You can use a Terraform resource to set a lifecycle configuration for a bucket managed by Terraform. To set a lifecycle configuration on an existing bucket that isn't yet managed by Terraform, you must first import the existing bucket.

To find out whether a lifecycle condition is supported by Terraform, see the Terraform documentation for the condition block.

REST APIs Note: To remove the lifecycle configuration for a bucket, set an empty lifecycle configuration. Check the lifecycle configuration for a bucket Console
  1. In the Google Cloud console, go to the Cloud Storage Buckets page.

    Go to Buckets

  2. In the bucket list, the lifecycle status of each bucket is found in the Lifecycle column.

    You can click this status to add, view, edit, and delete rules.

To learn how to get detailed error information about failed Cloud Storage operations in the Google Cloud console, see Troubleshooting.

Command line

Use the gcloud storage buckets describe command with the --format flag:

gcloud storage buckets describe gs://BUCKET_NAME --format="default(lifecycle_config)"

Where BUCKET_NAME is the name of the bucket whose lifecycle configuration you want to view. For example, my-bucket.

Client libraries C++

For more information, see the Cloud Storage C++ API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

C#

For more information, see the Cloud Storage C# API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. Go

For more information, see the Cloud Storage Go API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. Java

For more information, see the Cloud Storage Java API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. Node.js

For more information, see the Cloud Storage Node.js API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. PHP

For more information, see the Cloud Storage PHP API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. Python

For more information, see the Cloud Storage Python API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. Ruby

For more information, see the Cloud Storage Ruby API reference documentation.

To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.

To view the bucket's lifecycle policies, follow the instructions for displaying a bucket's metadata and look for the lifecycle policy fields in the response. REST APIs What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-02 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.5