Connect Google Cloud Platform to StackSpend
Track GCP costs using BigQuery billing export. StackSpend auto-detects your billing export tables and syncs cost data daily.
StackSpend connects to GCP via BigQuery billing export. Auto-detects export tables. Get daily cost visibility, 90 days of history, cost by project and service, and spend forecasting. Setup takes 5-10 minutes with a service account.
Important: BigQuery Billing Export Required
GCP only provides cost data via BigQuery billing export (batch, daily). No real-time API exists. The first sync takes 24-48 hours after enabling the export.
Prerequisites
- A GCP project with billing enabled
- Access to GCP Console with billing admin permissions
- BigQuery API enabled (required for billing export)
Enable Cloud Billing API
- 1Go to Cloud Billing API
- 2Select your project
- 3Click ENABLE and wait 1-2 minutes
Enable BigQuery Billing Export
This is where Google stores your cost data. StackSpend will read from this export.
- 1Go to GCP Billing Console
- 2Select your billing account
- 3Click Billing export in the left menu
- 4Under "BigQuery export" → Click EDIT SETTINGS
- 5Check ☑️ "Standard usage cost data"
- 6Select or create a dataset (e.g.,
billing_export) - 7Click SAVE
Note: StackSpend will auto-detect your billing export table. You can also manually specify the project ID, dataset ID, and table ID if auto-detection fails.
Create Service Account
- 1Go to Service Accounts
- 2Click CREATE SERVICE ACCOUNT
- 3Name:
stackspend-billing - 4Grant role: BigQuery Job User (at the project level)
- 5Click DONE
- 6Click into the service account → Keys tab → Add Key → Create new key
- 7Select JSON → Click CREATE
- 8Important: Save the downloaded JSON key file securely. You'll upload this in StackSpend.
Grant Billing Account Access
The service account needs permission to read billing data at the billing account level.
- 1Go to Billing Console → Select your billing account
- 2Click Account Management (or Permissions)
- 3Click ADD PRINCIPAL
- 4Paste your service account email (format:
stackspend-billing@PROJECT_ID.iam.gserviceaccount.com) - 5Role: Billing Account Viewer
- 6Click SAVE
Grant BigQuery Dataset Access
The service account needs permission to read the billing export dataset.
- 1Go to BigQuery Console
- 2Find your billing export dataset (e.g.,
billing_export) - 3Click the dataset → SHARING → Permissions
- 4Click ADD PRINCIPAL
- 5Paste your service account email
- 6Role: BigQuery Data Viewer
- 7Click SAVE
Connect in StackSpend
- 1Go to Settings → Providers in your StackSpend dashboard
- 2Click Add Provider → Select GCP
- 3Upload the service account JSON key file
- 4(Optional) Enter billing account ID, project ID, dataset ID, and table ID if auto-detection fails
- 5Click Test Connection to verify
- 6Once the test succeeds, click Connect
After Connecting
Once GCP is connected, StackSpend will begin syncing cost data from BigQuery. Note that there's a 24-48 hour delay for new data to appear in BigQuery.
- Costs sync automatically every 6 hours
- 24-48 hour delay for new cost data (Google's batch process)
- Project-level cost breakdowns
- Service-level and SKU-level cost tracking