This page shows you how to get the size of your Cloud Storage buckets.
Required permissions
Console
In order to complete this guide using the Google Cloud console, you must have the proper IAM permissions. If you did not create the bucket you want to access, you might need the project owner to give you a role that contains the necessary permissions.
For a list of permissions required for specific actions, see IAM permissions for the Google Cloud console.
For a list of relevant roles, see Cloud Storage roles. Alternatively, you can create a custom role that has specific, limited permissions.
Command line
In order to complete this guide using a command-line utility, you must have the proper IAM permissions. If you did not create the bucket you want to access, you might need the project owner to give you a role that contains the necessary permissions.
For a list of permissions required for specific actions, see
IAM
permissions for gcloud storage
commands.
For a list of relevant roles, see Cloud Storage roles. Alternatively, you can create a custom role that has specific, limited permissions.
Determine a bucket's size
Console
To view the metrics for a monitored resource by using the Metrics Explorer, do the following:
-
In the navigation panel of the Google Cloud console, select Monitoring, and then select leaderboard Metrics explorer:
- In the Metric element, expand the Select a metric menu,
enter
Total bytes
in the filter bar, and then use the submenus to select a specific resource type and metric:- In the Active resources menu, select GCS Bucket.
- In the Active metric categories menu, select Storage.
- In the Active metrics menu, select Total bytes.
- Click Apply.
To remove time series from the display, use the Filter element.
To combine time series, use the menus on the Aggregation element. For example, to display the CPU utilization for your VMs, based on their zone, set the first menu to Mean and the second menu to zone.
All time series are displayed when the first menu of the Aggregation element is set to Unaggregated. The default settings for the Aggregation element are determined by the metric type you selected.
- For quota and other metrics that report one sample per day, do the following:
- In the Display pane, set the Widget type to Stacked bar chart.
- Set the time period to at least one week.
You can also use the Metrics Explorer to measure other bucket metrics such as storage.googleapis.com/storage/object_count and storage.googleapis.com/storage/total_byte_seconds, which measure the daily number of objects and the daily storage consumed, respectively. See the Google Cloud metrics documentation for a complete list of available metrics and Metrics, time series, and resources for more information about using the Metrics Explorer.
Command line
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
- List the objects in your bucket.
- Get object metadata.
- Learn more about monitoring your resources in Monitoring.
Try it for yourself
If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud Storage free