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
gcloudCLI 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
Step 1 — Create a dedicated GCP project (recommended)
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.Step 3 — Enable Detailed BigQuery Billing Export
- In the GCP Console, go to Billing → Billing export
- Click Edit settings under BigQuery export
- Set the Project to your billing export project
- Set the Dataset to
billing_export(or whatever you named it in Step 2) - Enable Detailed usage cost — not Standard usage cost
- Click Save
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
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 Ifgcloud 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:
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)