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:
- Open Google Cloud Console
- Navigate to APIs & Services → Library
- Enable the following APIs:
Cloud Billing APICloud Resource Manager APIBigQuery API(for detailed cost export)
Step 2: Create a Service Account
- Go to IAM & Admin → Service Accounts
- Click Create Service Account
- Name it (e.g.,
cosmoscost-integration) - Add description: "CosmosCost billing data access"
- Click Create and Continue
Step 3: Assign Roles
Grant the service account these roles:
Billing Account Viewer- View billing account detailsBigQuery User- Query billing export dataBigQuery 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
- Click on the newly created service account
- Go to Keys tab
- Click Add Key → Create new key
- Select JSON format
- Download and securely store the key file
Step 5: Configure BigQuery Export (Recommended)
For detailed cost analysis, set up BigQuery billing export:
- Go to Billing → Billing Export
- Under BigQuery Export, click Edit Settings
- Select a project to host the BigQuery dataset
- Create or select a dataset (e.g.,
billing_export) - Enable both Standard and Detailed usage cost exports
- Save changes
Step 6: Connect in CosmosCost
- Log in to your CosmosCost dashboard
- Navigate to Settings → Cloud Accounts
- Click Add Cloud Account
- Select Google Cloud Platform
- Upload your service account JSON key file
- Enter your Billing Account ID
- Optionally, configure BigQuery dataset details
- 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
- Go to Google Cloud Console
- Navigate to Billing → Manage Billing Accounts
- Your Billing Account ID appears in the format:
XXXXXX-XXXXXX-XXXXXX - 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.