Stay organized with collections Save and categorize content based on your preferences.
Compute Engine lets you export detailed reports of your Compute Engine usage to a Cloud Storage bucket using the usage export feature. Usage reports provide information about the lifetime of your resources. For example, you can see how many VM instances in your project are running an n2-standard-4
machine type and how long each instance has been running. You can also review the storage space of a persistent disk, and information about other Compute Engine features.
Usage reports don't provide billing or activity information, such as information about API requests. For billing information, see the Export Cloud Billing data to BigQuery feature. For a record of administrative activities and accesses within your Google Cloud resources, see Audit logs.
Before you beginSelect the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.To use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
When you enable usage reports, Compute Engine delivers two types of reports to the Cloud Storage bucket you specify:
Daily usage reports
These reports are delivered daily and include usage data from the preceding day. Each report is a separate file that contains data from the last period. Data in these reports are immutable, meaning that Compute Engine does not update or rewrite the log file if there are inaccuracies. Instead, the data is corrected in the next new report that is delivered to the bucket.
Daily usage reports have the following name format:
<bucket>/<reportprefix><numeric_projectid><YYYYMMDD>.csv
Monthly rollup report
A single monthly rollup report is delivered daily, which contains monthly usage data for that project up to, but not including, that day. The monthly usage report is overwritten each day with new data that reflects the monthly usage of resources up to that date. There is only one monthly usage data file per project, per month.
Monthly rollup reports have following name format:
<bucket>/<reportprefix><numeric_projectid><YYYYMM>.csv
The daily and monthly report files look very similar, except for the difference in date format, where the monthly rollup reports are dated using the year and month (YYYYMM
), and the daily usage reports are dated using the year, month, and date (YYYYMMDD
).
All usage reports are delivered in comma-separated values (CSV) format and usage report files are prefixed using <report_prefix>
. The <report_prefix>
is a customizable value chosen by the user. If you don't specify a report prefix, the prefix usage_gce
is used by default. All times are given in Pacific time (PST).
Before you can start using Compute Engine usage export:
When you first enable the usage export feature, the first report is sent the following day, detailing the previous day's usage. Afterwards, you receive reports in 24 hour intervals.
When you enable this feature, you must define two properties:
The Cloud Storage bucket where you would like your reports to be delivered.
You can select any Cloud Storage bucket for which you are an owner, including buckets that are from different projects. This bucket must exist before you can start exporting reports and you must have owner access to the bucket. Cloud Storage charges for usage, so you should review Cloud Storage pricing for information on how you might incur charges for the service.
Any user who has read access to the Cloud Storage bucket can view the usage reports in the bucket. Any user who has write access to the bucket can create, view, and modify existing files in the bucket. For more information, see the Access control section.
The report prefix for your files.
You can specify the report prefix to use for your usage reports. Your usage reports then have filenames that contain this prefix. For example, specifying "my-cool-project-report" as your report prefix results in a filename similar to the format my-cool-project-report_1234567890_20131230.csv
. If you don't specify a report prefix, the default prefix usage_gce
is used.
After you decide on these two properties, you can enable the usage export feature in the following ways:
ConsoleGo to the Compute Engine Settings page.
Check the Enable usage export box.
Fill in the field asking for a Bucket name. Optionally, provide a Report prefix. If you leave the report prefix empty, the default prefix usage_gce
is used. All usage reports delivered to the bucket are named with this prefix.
Click Save.
Use the gcloud compute project-info set-usage-bucket
command to enable this feature:
gcloud compute project-info set-usage-bucket --bucket BUCKET_NAME --prefix PREFIX
Replace the following:
BUCKET_NAME
is the name of an existing bucket to receive the usage reports. The name must be in the format gs://bucket-name
or https://storage.googleapis.com/bucket-name
. The user running this command must be an owner of the bucket.PREFIX
is the optional prefix for the usage report names. If not specified, the default prefix is usage_gce
.To enable usage exports, use the set_usage_export_bucket()
method in the Projects
collection. The following example uses the Cloud Client Libraries for Python:
For more information, see the REST reference documentation for projects.setUsageExportBucket
After you start receiving usage reports in your bucket, download your reports like you would download other objects from Cloud Storage. For more information, see Download objects.
Supported metricsDaily usage reports provide usage information about the following resources:
Each resource is described using the following metrics:
Metric Name Metric Properties Report DateVmimageN2StandardCore_Uswest2
to represent an n2-standard
machine type in us-west2
.com.google.cloud/services/compute‑engine/VmimageN2StandardCore_Uswest2
com.google.cloud/services/compute‑engine/VmimageN2StandardRam_Uswest2
https://compute.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/my-n2-vm
GLOBAL
for global resources.us-central1-a
MeasurementId
fields to find the charges for a particular resource.
An example entry in the report would look like the following:
Report Date MeasurementId Quantity Unit Resource URI Resource ID Location 02/13/2019com.google.cloud/services/compute-engine/VmimageE2Standard_2
86400 seconds https://compute.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/instances/my-instance
16557630484 us-central1-a Access control
When you enable the usage export feature for a Cloud Storage bucket, Compute Engine automatically adds itself to the bucket with write access in order to deliver usage reports. As long as Compute Engine has access to the bucket and the usage export feature is enabled, Compute Engine continues to export usage reports to the specified Cloud Storage bucket.
You can identify that Compute Engine has access to a bucket if you see the following identity added to the bucket IAM policy:
cloud-cluster-analytics-export@google.com
Any user who is an owner of the project has full access to the Cloud Storage bucket. Other users, such as writers and readers, have different degrees of access to the bucket. To learn about IAM for a bucket, read IAM for Cloud Storage.
If you disable the usage export feature, Compute Engine automatically removes write access from Compute Engine to the bucket. If you modify the permissions on the cloud-cluster-analytics-export@google.com
account and then disable the usage export feature, Compute Engine disables the usage export feature but doesn't remove the account from the project access list. You can remove the account manually.
You can check on a project's usage export settings by getting information about the project:
gcloud compute project-info describe
Look for the usageExportLocation
field:
+-------------------------+----------------------------------------------------+ | name | myproject | | description | | | creation-time | 2019-10-18T16:31:52.308-07:00 | | usage | | | snapshots | 1.0/1000.0 | | networks | 2.0/2.0 | | firewalls | 3.0/10.0 | |... | | | usageExportLocation | | | bucketName | https://storage.googleapis.com/usage-export-sample | | reportNamePrefix | | +-------------------------+----------------------------------------------------+Disabling usage reports
When you disable usage reports, Compute Engine automatically removes write access for Compute Engine to your Cloud Storage bucket and stops sending new reports.
ConsoleGo to the Compute Engine Settings page.
Clear the Enable usage export box to disable usage export.
Disable the usage export feature by using the gcloud compute project-info set-usage-bucket
command with the --no-bucket
flag:
gcloud compute project-info set-usage-bucket --no-bucketNote: Specifying the
--bucket
flag without a bucket name doesn't disable the feature. You must use the --no-bucket
flag. Python
To disable usage exports, use the set_usage_export_bucket()
method in the Projects
collection with usage_export_location_resource
set to None
. The following example uses the Cloud Client Libraries for Python:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Compute Engine usage export allows you to send detailed reports about your resource usage to a designated Cloud Storage bucket, including information on VM instances, persistent disks, and more."],["Usage reports are delivered daily and monthly in CSV format, with daily reports covering the previous day's usage and monthly reports providing a cumulative view up to the current day."],["To enable usage export, you must specify a Cloud Storage bucket to store the reports and can optionally define a custom prefix for the report filenames; otherwise, the default prefix \"usage_gce\" is used."],["Access to the usage reports in the Cloud Storage bucket is controlled through standard Cloud Storage IAM permissions, with Compute Engine automatically granted write access upon enabling the export feature."],["You can disable usage export at any time, which removes Compute Engine's write access to the bucket and stops the generation of new reports, via console, gcloud, or Python."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4