GCP Integration

Connect your Google Cloud Platform projects using service account authentication.

Overview

CosmosCost integrates with Google Cloud Platform using the Cloud Billing API and BigQuery for detailed cost analysis. Service accounts provide secure, scoped access to your billing data without requiring personal credentials.

Key Features

Service Account Auth

Secure, scoped access to billing data

Read-Only Access

Cannot modify GCP resources

BigQuery Export

Detailed cost data with resource-level breakdown

Multi-Project Support

Connect multiple projects under one billing account

Prerequisites

  • Active GCP project with billing enabled
  • IAM permissions to create service accounts
  • Billing Account Viewer or Administrator role
  • CosmosCost Business or Business+ plan

Quick Setup

Step 1: Enable Required APIs

Enable these APIs in your GCP project:

  1. Open Google Cloud Console
  2. Navigate to APIs & Services → Library
  3. Enable the following APIs:
    • Cloud Billing API
    • Cloud Resource Manager API
    • BigQuery API (for detailed cost export)

Step 2: Create a Service Account

  1. Go to IAM & Admin → Service Accounts
  2. Click Create Service Account
  3. Name it (e.g., cosmoscost-integration)
  4. Add description: "CosmosCost billing data access"
  5. Click Create and Continue

Step 3: Assign Roles

Grant the service account these roles:

  • Billing Account Viewer - View billing account details
  • BigQuery User - Query billing export data
  • BigQuery Data Viewer - Read BigQuery datasets

Important

Billing Account Viewer role must be assigned at the billing account level, not the project level. Go to Billing → Manage Billing Accounts to assign this role.

Step 4: Create Service Account Key

  1. Click on the newly created service account
  2. Go to Keys tab
  3. Click Add Key → Create new key
  4. Select JSON format
  5. Download and securely store the key file

Step 5: Configure BigQuery Export (Recommended)

For detailed cost analysis, set up BigQuery billing export:

  1. Go to Billing → Billing Export
  2. Under BigQuery Export, click Edit Settings
  3. Select a project to host the BigQuery dataset
  4. Create or select a dataset (e.g., billing_export)
  5. Enable both Standard and Detailed usage cost exports
  6. Save changes

Step 6: Connect in CosmosCost

  1. Log in to your CosmosCost dashboard
  2. Navigate to Settings → Cloud Accounts
  3. Click Add Cloud Account
  4. Select Google Cloud Platform
  5. Upload your service account JSON key file
  6. Enter your Billing Account ID
  7. Optionally, configure BigQuery dataset details
  8. Click Connect Account

Success!

Your GCP account is connected. Initial sync may take up to 24 hours depending on data volume.

Finding Your Billing Account ID

  1. Go to Google Cloud Console
  2. Navigate to Billing → Manage Billing Accounts
  3. Your Billing Account ID appears in the format: XXXXXX-XXXXXX-XXXXXX
  4. Copy this ID to use when connecting your account in CosmosCost

Troubleshooting

Connection Failed

  • Verify service account key is valid JSON
  • Check all required APIs are enabled
  • Confirm Billing Account ID format

No Data Appearing

  • Wait 24 hours for initial sync
  • BigQuery export may take 24-48 hours initially
  • Verify project has billable usage

Permission Errors

  • Verify billing role is at billing account level
  • Check BigQuery dataset permissions
  • Review Cloud Audit Logs for denied requests

Still having issues? Check troubleshooting guide or contact support.