Skip to main content

Google Cloud Cost

DataDios reads Google Cloud cost from your BigQuery billing export, the daily copy of your bill that Google writes to a BigQuery table. The figures are what Google billed, after credits, not estimates. They appear on the Cost Dashboard under Infrastructure, next to AWS, Azure and Hetzner.

What you need​

#WhatWhere it is set up
1The billing export turned on, writing to a BigQuery datasetGoogle Cloud → Billing → Billing export
2A service account with Viewer and BigQuery Job User on the project to connectGoogle Cloud → IAM & Admin → Service Accounts
3BigQuery Data Viewer for that service account on the billing export datasetGoogle Cloud → BigQuery → the dataset → Sharing → Permissions
4A JSON key for the service accountThe service account's Keys tab
5A GCP data source in DataDios with Billing Table filled inData Explorer
6Workload analysis turned on, with GCP Cost Workload selectedThe data source's Workload tab

Items 1 to 5 are described step by step in Google Cloud Platform (GCP). Without item 3, the data source connects and lists resources, but every cost extraction fails.

Turn on GCP cost​

  1. In Data Explorer, click the Edit icon on the GCP data source's row.
  2. On the Connection tab, check that Billing Table holds the export's full table ID, for example acme-prod-123456.billing_export.gcp_billing_export_v1_0A1B2C_3D4E5F_6G7H8I, and click Test Connection.
  3. Open the Workload tab.
  4. Turn on Enable workload analysis.
  5. In Schedule, select Daily.
  6. Under Workflows, keep GCP Cost Workload selected.
  7. Click Save. DataDios collects the last 30 days of cost, or every day since the export was turned on, if that is less, and then one new day each day.

Check that cost was collected​

  1. Open Performance Analyzer → Datasources and find the GCP data source.
  2. Check that the last run succeeded. If it failed, its message says what is missing; see When the extraction fails.
  3. Open FinOps and click the Infrastructure tab.
  4. Click the Refresh button at the top right, so the page reads the new cost.
  5. GCP appears under Cost datasources and in the charts. Click its bar to see each GCP data source, and click a data source to see its services.

The GCP data source's own dashboards in Performance Analyzer show the same cost as GCP Cost Trend, Cost by GCP Service and GCP Cost Summary.

How the figures are counted​

  • After credits. Free tier, free trial, promotions, and sustained and committed use discounts are subtracted, so the figures match your invoice. A project that runs on free-trial credit shows 0.00, even though the billing export lists a cost for each service.
  • One project. A billing export holds every project on the billing account. DataDios keeps only the rows of the project in Project ID, so two GCP data sources on one billing account never count the same cost twice. Rows that belong to no project, such as tax and invoice adjustments, are left out.
  • Per service, per region, per day. Each figure is the cost of one Google Cloud service in one region on one day. Services billed without a region appear without one. Cost is not attached to individual resources.
  • Your billing currency. Figures are in the currency of the billing account, as Google reports it.
  • A day is collected once, the day after it ends. Google can still add late charges to a day for a few days, so the latest days can come out slightly below the invoice.
  • History starts with the export. Cost before the export was turned on cannot be shown. A standard export into a US or EU dataset also includes the previous month.

When the extraction fails​

MessageCause and fix
The service account cannot query the billing export table; grant it BigQuery Data Viewer on the dataset and BigQuery Job User on the project.Google refused the query. Check the roles in What you need, that Client Email is the account that holds them, that Billing Table is the exact table ID, and that a few minutes have passed since the roles were granted.
The billing export table was not found; check 'billing_table'.The table name has a typo, or the export was turned off and on again under a new table.
GCP cost extraction needs a BigQuery billing export table.Billing Table is empty. Fill it in on the Connection tab.
Data source rate limit or query throttle exceeded.BigQuery quota. DataDios tries the same day again on the next run.

To see Google's own reason for a refused query, run the check in Check the service account before you connect.