10-15 min setup

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.

Data appears in BigQuery 24-48 hours after enabling export (Google's batch process)

Prerequisites

  • A GCP project with billing enabled
  • Access to GCP Console with billing admin permissions
  • BigQuery API enabled (required for billing export)
Step 1

Enable Cloud Billing API

  1. 1Go to Cloud Billing API
  2. 2Select your project
  3. 3Click ENABLE and wait 1-2 minutes
Step 2

Enable BigQuery Billing Export

This is where Google stores your cost data. StackSpend will read from this export.

  1. 1Go to GCP Billing Console
  2. 2Select your billing account
  3. 3Click Billing export in the left menu
  4. 4Under "BigQuery export" → Click EDIT SETTINGS
  5. 5Check ☑️ "Standard usage cost data"
  6. 6Select or create a dataset (e.g., billing_export)
  7. 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.

Step 3

Create Service Account

  1. 1Go to Service Accounts
  2. 2Click CREATE SERVICE ACCOUNT
  3. 3Name: stackspend-billing
  4. 4Grant role: BigQuery Job User (at the project level)
  5. 5Click DONE
  6. 6Click into the service account → Keys tab → Add KeyCreate new key
  7. 7Select JSON → Click CREATE
  8. 8Important: Save the downloaded JSON key file securely. You'll upload this in StackSpend.
Step 4

Grant Billing Account Access

The service account needs permission to read billing data at the billing account level.

  1. 1Go to Billing Console → Select your billing account
  2. 2Click Account Management (or Permissions)
  3. 3Click ADD PRINCIPAL
  4. 4Paste your service account email (format: stackspend-billing@PROJECT_ID.iam.gserviceaccount.com)
  5. 5Role: Billing Account Viewer
  6. 6Click SAVE
Step 5

Grant BigQuery Dataset Access

The service account needs permission to read the billing export dataset.

  1. 1Go to BigQuery Console
  2. 2Find your billing export dataset (e.g., billing_export)
  3. 3Click the dataset → SHARINGPermissions
  4. 4Click ADD PRINCIPAL
  5. 5Paste your service account email
  6. 6Role: BigQuery Data Viewer
  7. 7Click SAVE
Step 6

Connect in StackSpend

  1. 1Go to SettingsProviders in your StackSpend dashboard
  2. 2Click Add Provider → Select GCP
  3. 3Upload the service account JSON key file
  4. 4(Optional) Enter billing account ID, project ID, dataset ID, and table ID if auto-detection fails
  5. 5Click Test Connection to verify
  6. 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

Know where your cloud and AI spend stands — every day, starting today.

Sign up
Connect Google Cloud Platform (GCP) to StackSpend — Step-by-Step Guide