Skip to main content
Cost Optix reads GCP cost data from a BigQuery billing export you configure in your GCP project. You must enable the Detailed usage cost export — the Standard export only provides service-level totals and does not include per-resource breakdowns, anomaly detection data, or label (tag) information.

Prerequisites

  • gcloud CLI installed and authenticated (gcloud auth login)
  • Permission to create service accounts and assign IAM roles in the GCP project
  • A Cloud Billing account linked to the project
  • A GCP project dedicated to hosting the BigQuery billing export (can be the same project you are monitoring)

How it works

GCP does not expose a direct cost query API. Cost Optix queries billing data from a BigQuery dataset that GCP writes to on a daily schedule. This means:
  • Data has a 1–3 day lag by design — this is a GCP platform constraint, not a Cost Optix limitation
  • Every FinOps tool that supports GCP (CloudHealth, Apptio, etc.) has the same lag for the same reason
  • Azure and AWS data is available in near-real time because those providers expose live query APIs

Required Permissions


Using a dedicated project for the billing export keeps costs and IAM clean. Skip this step if you already have a suitable project.

Step 2 — Create the BigQuery dataset

The dataset must exist before you enable billing export, otherwise GCP has nowhere to write the data.
Create the dataset before enabling billing export in the GCP Console. If the dataset does not exist when export is first enabled, GCP cannot create the table and no data will be written.

Step 3 — Enable Detailed BigQuery Billing Export

  1. In the GCP Console, go to Billing → Billing export
  2. Click Edit settings under BigQuery export
  3. Set the Project to your billing export project
  4. Set the Dataset to billing_export (or whatever you named it in Step 2)
  5. Enable Detailed usage cost — not Standard usage cost
  6. Click Save
Detailed usage cost is required. The Standard export provides only service-level totals. Without Detailed export, Cost Optix cannot show per-resource breakdowns, anomaly detection will be limited to service-level data, and label (tag) information will be missing.
GCP will automatically create a table named gcp_billing_export_resource_v1_<BILLING_ACCOUNT_ID> inside the dataset. Do not create this table manually — let GCP create it on first export.

Step 4 — Create the Service Account


Step 5 — Grant BigQuery Roles


Step 6 — Grant Billing Account Viewer

This role must be granted at the billing account level — not the project level. Project-level roles do not grant billing account visibility.

Step 7 — Download the Service Account Key

Some GCP organisations enforce constraints/iam.disableServiceAccountKeyCreation. If the command below fails with a policy violation, you need to temporarily allow key creation at the org level. See the troubleshooting section below.
Keep this file secure — it is the credential Cost Optix will use to access your billing data.

Step 8 — Enter Credentials in Cost Optix

Navigate to Admin → Accounts → Add Account, select Google Cloud Platform, choose Service Account JSON Key, and enter: Cost Optix will auto-discover the billing export table inside the billing_export dataset. If your dataset has a different name, you can specify it explicitly.

Billing lag

GCP billing data exported to BigQuery has a 1–3 day lag. This is a GCP platform constraint — today’s costs are not available yet. Cost Optix will automatically sync when data becomes available. No action is required on your part after initial setup.

Services tracked

Cost Optix reads all services from your BigQuery billing export, including:
  • Compute Engine — VM instances, disks, networking
  • Cloud Storage — storage, operations, retrieval
  • BigQuery — analysis, storage, streaming
  • Gemini API / Vertex AI — token usage, model inference
  • Cloud SQL, GKE, Cloud Run — database and container workloads
  • Cloud Logging, Cloud Monitoring — observability costs
  • Any other GCP service that appears in the Detailed billing export

Tag Explorer (Labels)

GCP uses labels instead of tags. Labels are included in the Detailed usage cost export at no extra configuration. Cost Optix reads label keys and values directly from BigQuery — no additional setup is required beyond the Detailed export being enabled.

Troubleshooting

Key creation blocked by org policy If gcloud iam service-accounts keys create fails with a policy violation (constraints/iam.disableServiceAccountKeyCreation), your organisation has disabled service account key creation. To temporarily allow it:
“Access Denied” or “Permission denied on BigQuery dataset” Confirm roles/bigquery.dataViewer is granted on the specific dataset. Dataset-level IAM is separate from project-level IAM in BigQuery — a project-level role alone is not sufficient. “Billing account not found” or billing data missing Verify roles/billing.viewer is assigned at the billing account level, not the project level. This is the most common setup mistake. No data after 3+ days Check that the BigQuery billing export is configured and Detailed usage cost is selected. Also confirm:
  • The dataset existed before export was enabled
  • The project and dataset IDs in Cost Optix match exactly what is configured in GCP Billing export settings
  • The service account has both BigQuery roles (bigquery.user + bigquery.dataViewer)
Service account key compromised or lost Create a new key in IAM & Admin → Service Accounts → [your service account] → Keys and delete the old key. Update the credential in Cost Optix under Admin → Accounts → Edit Account immediately.