website logo
HomeTwitterLinkedInLogin ➡️
⌘K
Overview
Getting started
Connect an Account
AWS Account
Azure Subscription
GCP Project
Managing Accounts
Reverse Terraform
Asset Explorer/Reverse Terraform
Environment Change Diff
Diff Email
Snapshot Diff
Ignored properties
Environment Explorer
Billing and cost
Getting billing data from GCP
Compliance
GraphQL API
IaC Catalog
Overview
Getting Started with Terraform Blueprints
Configuration
Producer Flow
Consumer Flow
CI/CD Configuration
Management
Security
Terraform State File Integrations
Integration
Asset Inventory
Feedback/Contact
Docs powered by archbee 

Getting billing data from GCP

5min

How to get billing data from your Google Cloud project

Before you can retrieve billing data, you must enable the Cloud Billing API for your Google Cloud project.

  1. Go to the Google Cloud Console (https://console.cloud.google.com/).
  2. Make sure you are in the correct project for which you want to get billing data.
  3. Click on the hamburger menu (three horizontal lines) in the upper left corner, and navigate to "APIs & Services" > "Library."
  4. In the search bar, type "Cloud Billing API" and click on the result.
  5. Click "Enable" to enable the API for your project.
  6. Set up authentication:

To access billing data, you'll need to authenticate your requests using a service account with the necessary permissions.

  1. Go to the Google Cloud Console (https://console.cloud.google.com/).
  2. Navigate to "IAM & Admin" > "Service Accounts."
  3. Click on "Create Service Account" and fill in the necessary details. Click "Create" when you're done.
  4. In the "Grant this service account access to project" section, select the "BigQuery Job User" role. This role will allow your service account to access the BigQuery dataset for billing. Click "Continue."
  5. Click "Done" to finish creating the service account.
  6. Find your newly created service account in the list, and click on the three vertical dots under "Actions." Select "Manage keys."
  7. Click on "Add Key" and choose "JSON." A JSON key file will be generated and downloaded to your computer. Store this file securely, as it contains sensitive information that can be used to access your project's billing data.

Adding a new billing account to Autocloud

To add a new billing account to Autocloud, you will need to generate a Service Account Key for the Google project hosting the BigQuery dataset for billing. The Service Account Key must have the "BigQuery Job User" role. Follow the steps in the "Set up authentication" section above to create a service account with the "BigQuery Job User" role and generate a JSON key file.

Once you have the JSON key file, you can provide it to Autocloud during the billing account setup process. The Autocloud platform will use this key to access the BigQuery dataset and retrieve billing data from your Google Cloud project.

This step can be done while creating a GCP project for the first time, or when you try to create a new snapshot:

Add a new billing account
Add a new billing account

  1. Upload the JSON key file
  2. Set up Billing Information
    1. Billing Account ID
    2. Project ID Hosting BigQuery Dataset
    3. BigQuery Dataset Name



Updated 31 Mar 2023
Did this page help you?
Yes
No
PREVIOUS
Save diagram image
NEXT
Compliance at a glance
Docs powered by archbee 
TABLE OF CONTENTS
How to get billing data from your Google Cloud project
Adding a new billing account to Autocloud