Set and retrieve Compute Engine usage export bucket
Stay organized with collections
Save and categorize content based on your preferences.
This sample shows you how to set and retrieve the Compute Engine usage export bucket for a project. The usage export bucket is a Google Cloud Storage bucket where Compute Engine usage reports are stored. The usage reports can be used for billing and cost management purposes.
Code sample
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.
[[["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"]],[],[[["\u003cp\u003eThis sample demonstrates how to configure a Google Cloud Storage bucket to store Compute Engine usage reports.\u003c/p\u003e\n"],["\u003cp\u003eUsage reports stored in the designated bucket can be used to manage billing and costs related to Compute Engine.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eset_usage_export_bucket\u003c/code\u003e function allows you to specify the bucket and an optional report name prefix, which defaults to "usage_gce" if not specified.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eget_usage_export_bucket\u003c/code\u003e function retrieves the current usage export settings, automatically replacing an empty report name prefix with the default "usage_gce".\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to Compute Engine uses Application Default Credentials.\u003c/p\u003e\n"]]],[],null,[]]