Skip to main content

Connect GCP

oncost collects GCP costs via the BigQuery billing export. Setup takes about 10 minutes.

Prerequisites

  • A GCP project with billing enabled
  • Permission to create service accounts and enable BigQuery billing export

Step 1: Enable billing export to BigQuery

If you don’t already have billing export enabled:
  1. Go to GCP Console > Billing > Billing export
  2. Click Edit settings under BigQuery export
  3. Select a project and dataset (create a new dataset if needed, e.g., billing_export)
  4. Select Detailed usage cost export type
  5. Click Save
GCP starts populating data within a few hours.

Step 2: Create a service account

  1. Go to GCP Console > IAM & Admin > Service Accounts
  2. Click Create Service Account
  3. Name it (e.g., oncost-billing-reader)
  4. Grant the role BigQuery Data Viewer on the billing dataset
  5. Grant the role BigQuery Job User on the project
  6. Click Done
  7. Create a JSON key for the service account and download it

Step 3: Complete the connection

In oncost, go to Settings > Connections > New Connection > GCP:
  1. Upload or paste the service account JSON key
  2. Enter the BigQuery dataset name (e.g., project-id.billing_export)
  3. Click Test Connection to verify access
  4. Click Save

What oncost collects

  • Daily cost breakdown by service, SKU, project, and region
  • Usage quantities and units
  • Labels applied to resources
  • Credits and discounts

Troubleshooting

IssueFix
”Permission denied”Verify the service account has BigQuery Data Viewer on the billing dataset and BigQuery Job User on the project.
No dataBigQuery export can take a few hours to start. Check the export settings in GCP Console.
Missing labelsLabels appear in the billing export automatically. Ensure resources are labeled in GCP.