Getting Bucket Information

This page shows you how get information on the size and metadata of your Cloud Storage buckets. For an overview of buckets, read the Key Terms. To learn more about specific bucket properties, see Storage Classes and Bucket Locations.

Determining a bucket's size

To get the size of a bucket, use the gsutil command line tool. Specifically, use the gsutil du command with a -s flag:

gsutil du -s gs://[BUCKET_NAME]/

where [BUCKET_NAME] is the name of the desired bucket.

The response looks like the following example:

134620      gs://[BUCKET_NAME]

In this example, the size of the bucket is 134,620 bytes.

Displaying a bucket's location and default storage class

To display the geographic location and default storage class of a 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 verify, and check its Location and Default storage class.

    Verify Multi-Regional Storage bucket class.

gsutil

Use the following gsutil ls command, replacing [VALUES_IN_BRACKETS] with the appropriate values:

gsutil ls -L -b gs://[BUCKET_NAME]/

The response looks like the following example:

gs://[BUCKET_NAME]/ :
  Storage class:         MULTI_REGIONAL
  Location constraint:   US
  ...

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. Use cURL to call the JSON API with a GET Bucket request that includes the desired fields, replacing [VALUES_IN_BRACKETS] with the appropriate values:
    curl -X GET -H "Authorization: Bearer [OAUTH2_TOKEN]" \
        "https://www.googleapis.com/storage/v1/b/[BUCKET_NAME]?fields=location%2CstorageClass"

The response looks like the following example:

{
  "location": "US",
  "storageClass": "MULTI_REGIONAL"
  "labels" : {
     ([YOUR_LABEL_KEY]): [YOUR_LABEL_VALUE]
   },
}

XML API

  1. Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
  2. Use cURL to call the XML API with a GET Bucket request that includes the desired query string parameter:
    • location for getting the location of the bucket.
    • storageClass for getting the default storage class of the bucket.
    Note that you can use only one such query parameter at a time with the XML API. For example, to get the location of a bucket, use the following command, replacing [VALUES_IN_BRACKETS] with the appropriate values:
    curl -X GET -H "Authorization: Bearer [OAUTH2_TOKEN]" \
        "https://storage.googleapis.com/[BUCKET_NAME]?location"

The response looks like the following example:

<LocationConstraint>US</LocationConstraint>

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Storage
Need help? Visit our support page.