[Concepts](https://docs.cloud.google.com/storage/docs/bucket-metadata.md.txt)

This page shows you how to get the size of your Cloud Storage [buckets](https://docs.cloud.google.com/storage/docs/buckets.md.txt).

## Required roles

In order to get the required permissions 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. If you plan on
using the Google Cloud console, ask your administrator to grant you the
Monitoring Viewer (`roles/monitoring.viewer`) role on the project that contains
the bucket instead.

These roles contain the permissions required to get the size of a bucket.
To see the exact permissions that are required, expand the
**Required permissions** section:

#### Required permissions

- `storage.objects.list`
  - This permission is only required for using the Google Cloud CLI to perform the instructions on this page.

To see the permissions associated with `roles/monitoring.viewer`,
refer to the
[Monitoring Viewer documentation](https://docs.cloud.google.com/iam/docs/roles-permissions/monitoring.md.txt#monitoring.editor).

You might be able to get the required permission with other
[predefined roles](https://docs.cloud.google.com/iam/docs/understanding-roles) or [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt). For instructions on granting roles
on buckets, see [Set and manage IAM policies on buckets](https://docs.cloud.google.com/storage/docs/access-control/using-iam-permissions.md.txt). For instructions on
granting roles on projects, see [Manage access to projects](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).

## Determine a bucket's size

### Console

> [!NOTE]
> **Note:** Monitoring measures bucket size once a day and does not report empty buckets. To measure bucket size at a given moment for any bucket, use `gcloud storage` instead.

To view the metrics for a monitored resource by using the
Metrics Explorer, do the following:

1. In the Google Cloud console, go to the
   **Metrics explorer** page:

   [Go to **Metrics explorer**](https://console.cloud.google.com/monitoring/metrics-explorer)

   <br />

   If you use the search bar to find this page, then select the result whose subheading is
   **Monitoring**.
2. In the toolbar of the Google Cloud console, select your Google Cloud project. For [App Hub](https://docs.cloud.google.com/app-hub/docs/overview.md.txt) configurations, select the App Hub host project or the app-enabled folder's management project.
3. In the **Metric** element, expand the **Select a metric** menu, enter `Total bytes (v2)` in the filter bar, and then use the submenus to select a specific resource type and metric:
   1. In the **Active resources** menu, select **GCS Bucket**.
   2. In the **Active metric categories** menu, select **Storage**.
   3. In the **Active metrics** menu, select **Total bytes (v2)**.
   4. Click **Apply**.

   The fully qualified name for this metric is **storage.googleapis.com/storage/v2/total_bytes**.
4. To add filters, which remove time series from the query results, use the
   [**Filter** element](https://docs.cloud.google.com/monitoring/charts/metrics-selector.md.txt#filter-option).

5. To combine time series, use the menus on the
   [**Aggregation** element](https://docs.cloud.google.com/monitoring/charts/metrics-selector.md.txt#select_display).
   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.
6. For quota and other metrics that report one sample per day, do the following:
   1. In the **Display** pane, set the **Widget type** to **Stacked bar chart**.
   2. 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/v2/total_byte_seconds** , which measure the
daily number of objects and the daily storage consumed, respectively. See
the [Google Cloud metrics documentation](https://docs.cloud.google.com/monitoring/api/metrics_gcp_p_z.md.txt#gcp-storage) for a complete list of
available metrics and [Metrics, time series, and resources](https://docs.cloud.google.com/monitoring/api/v3/metrics.md.txt) for more
information about using the Metrics Explorer.

### Command line

> [!CAUTION]
> **Caution:** The `gcloud storage du` command calculates the current space usage by making a series of object listing requests, which can take a long time for large buckets. If the number of objects in your bucket is hundreds of thousands or more, or if you want to monitor your bucket size over time, use Monitoring instead, as described in the Console tab.

Use the [`gcloud storage du`](https://docs.cloud.google.com/sdk/gcloud/reference/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](https://docs.cloud.google.com/storage/docs/listing-objects.md.txt).
- [Get object metadata](https://docs.cloud.google.com/storage/docs/viewing-editing-metadata.md.txt).
- [Learn more about monitoring your resources in Monitoring](https://docs.cloud.google.com/monitoring/api/v3/metrics.md.txt).