Changing the Default Storage Class of a Bucket

This page shows you how to change the default storage class for your buckets. When you upload an object to the bucket, if you don't specify a storage class for the object, the object is assigned the bucket's default storage class. For an overview of buckets, read the Key Terms. To learn more about storage classes, see Storage Classes.

To change the default storage class of an existing bucket:

Console

  1. Open the Cloud Storage browser in the Google Cloud Platform Console.
    Open the Cloud Storage browser
  2. In the bucket list, find the bucket you want to modify, and click its more options button (three vertical dots).

  3. Click Edit default storage class.

  4. In the overlay window, select the new default storage class you would like for your bucket.

    Note that based on the location of your bucket, not all storage classes are available.

    Edit bucket storage class.

  5. Click Save.

gsutil

Use the gsutil defstorageclass set command with the desired storage class, replacing [VALUES_IN_BRACKETS] with the appropriate values:

gsutil defstorageclass set [STORAGE_CLASS] gs://[BUCKET_NAME]

The response looks like the following example:

Setting default storage class to "[STORAGE_CLASS]" for bucket gs://[BUCKET_NAME]

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 PUT --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]?fields=storageClass"

XML 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 .xml file that contains the following information, replacing [VALUES_IN_BRACKETS] with the appropriate values:
  3. <StorageClass>[STORAGE_CLASS]</StorageClass>
  4. Use cURL to call the XML API, replacing [VALUES_IN_BRACKETS] with the appropriate values:
    curl -X PUT --data-binary @[XML_FILE_NAME].xml \
        -H "Authorization: Bearer [OAUTH2_TOKEN]" \
        "https://storage.googleapis.com/[BUCKET_NAME]?storageClass"

What's next

¿Te sirvió esta página? Envíanos tu opinión:

Enviar comentarios sobre…

¿Necesitas ayuda? Visita nuestra página de asistencia.