A RetroSearch Logo

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

Search Query:

Showing content from https://cloud.google.com/storage/docs/changing-storage-classes below:

Change object storage classes | Cloud Storage

Skip to main content Change object storage classes

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

This page describes how to change the storage class of objects within a bucket through rewriting the object.

Required roles

In order to get the required permissions for changing the storage class of an object through rewriting the object, ask your administrator to grant you the Storage Object User (roles/storage.objectUser) role on the bucket.

This role contains the permissions required to change the storage class of an object. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

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

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

Change an object's storage class

Complete the following steps to change an object's storage class:

Console

Individual object storage classes cannot be set through the Google Cloud console. Instead, use the Google Cloud CLI.

Command line

Use the gcloud storage objects update command with the --storage-class flag. For example:

gcloud storage objects update gs://BUCKET_NAME/OBJECT_NAME --storage-class=STORAGE_CLASS

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.

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.

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.

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.

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.

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.

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.

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.

REST APIs JSON API Caution: ACLs that you want to retain from the original object must be included in the object resource that you provide in the request body.
  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

  2. Create a JSON file that contains the following information:

    {
      "storageClass": "STORAGE_CLASS"
    }

    Where:

  3. Use cURL to call the JSON API with a POST Object, request:

    curl -X POST --data-binary @JSON_FILE_NAME \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/json" \
      "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME/o/OBJECT_NAME/rewriteTo/b/BUCKET_NAME/o/OBJECT_NAME"

    Where:

XML API Caution: Metadata that you want to retain from the original object, such as custom metadata, must be included in the headers that you provide in the request. Additionally, any ACLs for the object that differ from the containing bucket's default object ACLs must be reapplied after the object is uploaded.
  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

  2. Use cURL to call the XML API with a PUT Object request:

    curl -X PUT --data-binary @OBJECT \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: OBJECT_CONTENT_TYPE" \
      -H "x-goog-storage-class: STORAGE_CLASS" \
      "https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME"

    Where:

Note: This guide involves rewriting data, which is a Class A operation and which might incur additional charges, depending on the age, location, and storage class of the data. For more information, see Cloud Storage pricing. Also note that if you have enabled Object Versioning for your bucket, the original object remains in your bucket until it is explicitly deleted. 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