Auf dieser Seite erfahren Sie, wie Sie die Größe Ihrer Cloud Storage-Buckets ermitteln.
Erforderliche Rollen
Bitten Sie Ihren Administrator, Ihnen die Rolle Storage-Objekt-Betrachter (roles/storage.objectViewer) für den Bucket zuzuweisen, um die erforderlichen Berechtigungen zum Abrufen der Größe eines Cloud Storage-Buckets zu erhalten. Wenn Sie die Google Cloud Console verwenden möchten, bitten Sie Ihren Administrator, Ihnen stattdessen die Rolle Monitoring-Betrachter (roles/monitoring.viewer) für das Projekt zuzuweisen, das den Bucket enthält.
Diese Rollen enthalten die Berechtigungen, die zum Ermitteln der Größe eines Buckets erforderlich sind.
Erweitern Sie den Abschnitt Erforderliche Berechtigungen, um die erforderlichen Berechtigungen anzuzeigen:
Erforderliche Berechtigungen
storage.objects.list
Diese Berechtigung ist nur erforderlich, um mit der Google Cloud CLI die Anleitungen auf dieser Seite auszuführen.
Wenn Sie diese Seite über die Suchleiste suchen, wählen Sie das Ergebnis aus, dessen Zwischenüberschrift Monitoring ist.
Wählen Sie in der Symbolleiste der Google Cloud -Console Ihr Google Cloud -Projekt aus.
Wählen Sie für App Hub-Konfigurationen das App Hub-Hostprojekt oder das Verwaltungsprojekt des für Apps aktivierten Ordners aus.
Maximieren Sie im Element Messwert das Menü Messwert auswählen, geben Sie Total bytes (v2) in die Filterleiste ein und wählen Sie dann über die Untermenüs einen bestimmten Ressourcentyp und Messwert aus:
Wählen Sie im Menü Aktive Ressourcen die Option GCS-Bucket aus.
Wählen Sie im Menü Aktive Messwertkategorien die Option Speicher aus.
Wählen Sie im Menü Aktive Messwerte die Option Bytes insgesamt aus.
Klicken Sie auf Anwenden.
Der voll qualifizierte Name für diesen Messwert lautet storage.googleapis.com/storage/v2/total_bytes.
Verwenden Sie das Element Filter, um Zeitreihen aus der Anzeige zu entfernen.
Verwenden Sie zum Kombinieren von Zeitreihen die Menüs im Element Aggregation.
Wenn Sie beispielsweise die CPU-Auslastung für Ihre VMs basierend auf ihrer Zone anzeigen möchten, legen Sie das erste Menü auf Mittelwert und das zweite Menü auf Zone fest.
Alle Zeitreihen werden angezeigt, wenn das erste Menü des Elements Aggregation auf Nicht aggregiert gesetzt ist. Die Standardeinstellungen für das Element Aggregation werden durch den ausgewählten Messwerttyp bestimmt.
Gehen Sie für Kontingente und andere Messwerte, die eine Stichprobe pro Tag melden, so vor:
Legen Sie im Bereich Anzeige den Widget-Typ auf Gestapeltes Balkendiagramm fest.
Legen Sie als Zeitraum mindestens eine Woche fest.
Sie können Metrics Explorer auch verwenden, um andere Bucket-Messwerte zu ermitteln, z. B. storage.googleapis.com/storage/object_count und storage.googleapis.com/storage/v2/total_byte_seconds, die die tägliche Anzahl der genutzten Objekte bzw. den täglich genutzten Speicher messen. Eine vollständige Liste der verfügbaren Messwerte finden Sie in der Dokumentation zuGoogle Cloud -Messwerten. Weitere Informationen zur Verwendung von Metrics Explorer finden Sie unter Messwerte, Zeitachsen und Ressourcen.
Befehlszeile
Verwenden Sie den Befehl gcloud storage du mit dem Flag --summarize:
gcloud storage du gs://BUCKET_NAME --summarize
Dabei ist BUCKET_NAME der Name des entsprechenden Buckets.
Die Antwort sieht in etwa so aus:
134620 gs://my-bucket
In diesem Beispiel beträgt die Größe des Buckets mit dem Namen my-bucket 134.620 Byte.
Wenn Sie mit Google Cloud noch nicht vertraut sind, erstellen Sie ein Konto, um die Leistungsfähigkeit von Cloud Storage in der Praxis sehen und bewerten zu können. Neukunden erhalten außerdem ein Guthaben von 300 $, um Arbeitslasten auszuführen, zu testen und bereitzustellen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-25 (UTC)."],[],[],null,["# Get bucket size\n\n[Concepts](/storage/docs/bucket-metadata)\n\nThis page shows you how to get the size of your Cloud Storage [buckets](/storage/docs/buckets).\n\nRequired roles\n--------------\n\nIn order to get the required permissions for getting the size of a\nCloud Storage bucket, ask your administrator to grant you the Storage\nObject Viewer (`roles/storage.objectViewer`) role on the bucket. If you plan on\nusing the Google Cloud console, ask your administrator to grant you the\nMonitoring Viewer (`roles/monitoring.viewer`) role on the project that contains\nthe bucket instead.\n\nThese roles contain the permissions required to get the size of a bucket.\nTo see the exact permissions that are required, expand the\n**Required permissions** section: \n\n#### Required permissions\n\n- `storage.objects.list`\n - This permission is only required for using the Google Cloud CLI to perform the instructions on this page.\n\nTo see the permissions associated with `roles/monitoring.viewer`,\nrefer to the\n[Monitoring Viewer documentation](/iam/docs/understanding-roles#monitoring.editor).\n\nYou might be able to get the required permission with other\n[predefined roles](/iam/docs/understanding-roles) or [custom roles](/iam/docs/creating-custom-roles). For instructions on granting roles\non buckets, see [Use IAM with buckets](/storage/docs/access-control/using-iam-permissions#bucket-iam). For instructions on\ngranting roles on projects, see [Manage access to projects](/iam/docs/granting-changing-revoking-access).\n\nDetermine a bucket's size\n-------------------------\n\n### Console\n\n| **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.\n\nTo view the metrics for a monitored resource by using the\nMetrics Explorer, do the following:\n\n1. In the Google Cloud console, go to the\n *leaderboard* **Metrics explorer** page:\n\n [Go to **Metrics explorer**](https://console.cloud.google.com/monitoring/metrics-explorer)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the Google Cloud console, select your Google Cloud project. For [App Hub](/app-hub/docs/overview) configurations, select the App Hub host project or the app-enabled folder's management project.\n3. 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:\n 1. In the **Active resources** menu, select **GCS Bucket**.\n 2. In the **Active metric categories** menu, select **Storage**.\n 3. In the **Active metrics** menu, select **Total bytes (v2)**.\n 4. Click **Apply**.\n\n The fully qualified name for this metric is **storage.googleapis.com/storage/v2/total_bytes**.\n4. To remove time series from the display, use the\n [**Filter** element](/monitoring/charts/metrics-selector#filter-option).\n\n5. To combine time series, use the menus on the\n [**Aggregation** element](/monitoring/charts/metrics-selector#select_display).\n For example, to display the CPU utilization for your VMs, based on their zone, set the\n first menu to **Mean** and the second menu to **zone**.\n\n All time series are displayed when the first menu of the **Aggregation** element is set\n to **Unaggregated** . The default settings for the **Aggregation** element\n are determined by the metric type you selected.\n6. For quota and other metrics that report one sample per day, do the following:\n 1. In the **Display** pane, set the **Widget type** to **Stacked bar chart**.\n 2. Set the time period to at least one week.\n\nYou can also use the Metrics Explorer to measure other bucket metrics\nsuch as **storage.googleapis.com/storage/object_count** and\n**storage.googleapis.com/storage/v2/total_byte_seconds** , which measure the\ndaily number of objects and the daily storage consumed, respectively. See\nthe [Google Cloud metrics documentation](/monitoring/api/metrics_gcp_p_z#gcp-storage) for a complete list of\navailable metrics and [Metrics, time series, and resources](/monitoring/api/v3/metrics) for more\ninformation about using the Metrics Explorer.\n\n### Command line\n\n| **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.\n\nUse the [`gcloud storage du`](/sdk/gcloud/reference/storage/du) command with a `--summarize` flag: \n\n```\ngcloud storage du gs://BUCKET_NAME --summarize\n```\n\nwhere \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e is the name of the relevant\nbucket.\n\nThe response looks like the following example: \n\n```\n134620 gs://my-bucket\n```\n\nIn this example, the size of the bucket named `my-bucket` is 134,620\nbytes.\n\nWhat's next\n-----------\n\n- [List the objects in your bucket](/storage/docs/listing-objects).\n- [Get object metadata](/storage/docs/viewing-editing-metadata).\n- [Learn more about monitoring your resources in Monitoring](/monitoring/api/v3/metrics).\n\nTry it for yourself\n-------------------\n\n\nIf you're new to Google Cloud, create an account to evaluate how\nCloud Storage performs in real-world\nscenarios. New customers also get $300 in free credits to run, test, and\ndeploy workloads.\n[Try Cloud Storage free](https://console.cloud.google.com/freetrial)"]]