Get bucket size

Concepts

This page shows you how to get the size of your Cloud Storage buckets.

Required roles

In order to get the required permission for getting the size of a Cloud Storage bucket, ask your administrator to grant you the Storage Object Viewer (roles/storage.objectViewer) role on the bucket.

This role contain the permission required to get the size of a bucket. To see the exact permission that is required, expand the Required permissions section:

Required permissions

  • storage.objects.list

You might be able to get the required permission with other predefined roles or custom roles. For instructions on granting roles on buckets, see Use IAM with buckets. For instructions on granting roles on projects, see Manage access to projects.

Determine a bucket's size

Use the gcloud storage du command with a --summarize flag:

gcloud storage du gs://BUCKET_NAME --summarize

where BUCKET_NAME is the name of the relevant bucket.

The response looks like the following example:

134620      gs://my-bucket

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

What's next