Changing Object Storage Classes

This page describes how to change the storage class of objects within a bucket through overwriting the object. To learn how to change object storage classes without overwriting an object, see the Object Lifecycle Management feature. To learn more about per-object storage classes, see Per-Object Storage Classes.

Console

Individual object storage classes cannot be set through the Console. Instead use gsutil.

gsutil

Use the -s flag in a rewrite command. For example:

gsutil rewrite -s [STORAGE_CLASS] gs://[PATH_TO_OBJECT]

Where [STORAGE_CLASS] is the new storage class for your object and [PATH_TO_OBJECT] is the name of the object whose class you're changing.

REST APIs

JSON API

  1. Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
  2. Create a .json file that contains the following information, replacing [VALUES_IN_BRACKETS] with the appropriate values:
  3. {
      "storageClass": "[STORAGE_CLASS]"
    }
  4. Use cURL to call the JSON API, replacing [VALUES_IN_BRACKETS] with the appropriate values:
    curl -X POST --data-binary @[JSON_FILE_NAME].json \
        -H "Authorization: Bearer [OAUTH2_TOKEN]" \
        -H "Content-Type: application/json" \
        "https://www.googleapis.com/storage/v1/b/[BUCKET_NAME]/o/[OBJECT_NAME]/rewriteTo/b/[BUCKET_NAME]/o/[OBJECT_NAME]"

XML API

  1. Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
  2. Include the object whose storage class should be changed in the request (you must re-upload the object when changing storage class with the XML API).
  3. Use cURL to call the XML API, replacing [VALUES_IN_BRACKETS] with the appropriate values:
    curl -X PUT --data-binary @[OBJECT] \
        -H "Authorization: Bearer [OAUTH2_TOKEN]" \
        -H "Content-Type: [OBJECT_CONTENT_TYPE]" \
        -H "x-goog-project-id: [PROJECT_ID]" \
        -H "x-goog-storage-class: [STORAGE_CLASS]" \
        "https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]"

For more information, see the Set Object Storage Class page.

Send feedback about...

Cloud Storage Documentation