Google Cloud Billing Export Guide: BigQuery Setup for Cost Analysis
Google Cloud Billing Export to BigQuery is one of the most useful foundations for FinOps on GCP. It gives you detailed, queryable billing data so you can build custom reports, track trends, and understand which services and projects drive spend. This guide covers setup steps, schema basics, and common queries.
Analyze Billing Data with InfraPilotWhy Export Google Cloud Billing to BigQuery?
- Granular billing data: service, SKU, project, region, labels
- Custom analysis: SQL-based reporting for any dimension
- Trend visibility: keep historical billing data over time
- Integrations: Looker Studio dashboards, FinOps tools, and internal reporting
Cost note: Exporting billing data doesn’t add an “export fee.” BigQuery storage and query usage may incur costs depending on dataset size and how you query it.
Prerequisites
- Access to a GCP project with billing enabled
- Billing account access to configure export
- BigQuery permissions to create a dataset and manage access
Step-by-Step Setup Guide
1Create a BigQuery Dataset
- Open the BigQuery console
- Select a project to host billing data (can be a dedicated billing project)
- Create a dataset (choose a location, and avoid table expiration)
2Enable Billing Export
- Go to Billing → Billing export
- Enable Detailed usage cost export to your dataset
- Save settings
Note: It can take up to 24–48 hours for the first data to appear in BigQuery. Export is not retroactive by default.
3(Optional) Enable Pricing Export
Pricing export can help with what-if analysis and rate lookups. It’s optional for many teams; detailed usage cost export is usually enough to start.
4Configure Permissions
- Humans (FinOps/engineering): read access on the dataset
- Tools: read access plus job execution permission to run queries
Understanding the Billing Export Schema
Billing export typically creates a table named like gcp_billing_export_v1_<BILLING_ACCOUNT_ID>. Common fields include:
service.description,sku.descriptionproject.id,project.nameusage_start_time,usage_end_timelocation.regioncost,currencylabels
Common BigQuery Billing Queries
Total Cost by Service (Last 30 Days)
SELECT
service.description AS service,
SUM(cost) AS total_cost,
currency
FROM `project-id.billing_export.gcp_billing_export_v1_XXXXX`
WHERE DATE(usage_start_time) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY service, currency
ORDER BY total_cost DESC;
Cost by Project (Current Month)
SELECT
project.name AS project,
SUM(cost) AS total_cost,
currency
FROM `project-id.billing_export.gcp_billing_export_v1_XXXXX`
WHERE DATE(usage_start_time) >= DATE_TRUNC(CURRENT_DATE(), MONTH)
GROUP BY project, currency
ORDER BY total_cost DESC;
Top 10 Most Expensive SKUs
SELECT
service.description AS service,
sku.description AS sku,
SUM(cost) AS total_cost,
currency
FROM `project-id.billing_export.gcp_billing_export_v1_XXXXX`
WHERE DATE(usage_start_time) >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
GROUP BY service, sku, currency
ORDER BY total_cost DESC
LIMIT 10;
Best Practices
Use a Dedicated Billing Project
A dedicated billing project can simplify IAM and keep finance data separated from production workloads.
Label Resources for Attribution
Consistent labels enable cost attribution by team and environment.
Query Efficiently
Filter by date to leverage partitioning and reduce scanned data. Avoid SELECT *.
Integrating Billing Export with InfraPilot
- Sign in to InfraPilot
- Add an environment and select GCP billing analysis
- Grant read access to the billing dataset + permission to run queries
- Run cost analysis and generate AI insights