Connecting GCP Cloud Billing

Step-by-step guide on how to export GCP Cloud Billing data

Use the guide below to easily configure GCP Cloud Billing integration.

GCP Setup

Prerequisites

  • GCP project with billing export enabled. Follow the official documentation to set up Cloud Billing data export to BigQuery

Standard usage cost, Detailed usage cost, and Pricing should be enabled.

  • BigQuery dataset with billing export data

  • Service account with the relevant permissions

Service Account Required permissions

  • BigQuery Data Viewer on the billing export dataset

  • BigQuery Job User permission

  • Service Account Token Creator (for impersonation)

Variables

These variables will be used in the next steps to complete your GCP Billing profile setup.

Configuring GCP access

Follow these steps to grant PerfectScale the required permissions.

  1. Create Service Account

  2. Assign the roles required to enable BigQuery access:

    • BigQuery Data Viewer

    • BigQuery Job User

  3. On the tab Principals with access, grant permissions to the principal perfectscale-gcp-cur-accessor@psc-dev-1-000001.iam.gserviceaccount.com with the role Service Account Token Creator.

Principals with access

The customer should provide their Service Account email (e.g., [email protected]). This account will be used by PerfectScale to access the necessary billing and usage data.

Configuring GCP Billing Export integration with GCP profile

Once everything above is in place, the next step is to create a GCP Billing profile and connect it to the cluster(s) you need.

🛠️ How to create GCP Billing profile

There are two options for creating a Profile: from the Settings tab or directly from the Overview.

GCP Billing profile from the settings

Go to the Settings tab on the left panel -> select Pricing -> click the +Add Profile button -> select GCP Billing -> name the profile and put the needed values in the relevant fields -> click Save button.

From the Overview tab

Go to the Overview tab on the left panel -> find the cluster to which you want to apply the Azure Profile and click gear button -> go to Customizations -> click on Add New Profile in the Pricing Profile drop-down list -> select GCP Billing type -> name and configure your profile -> click the Save And Apply button -> click the Save Changes button.

GCP Billing profile from the overview

GCP Billing profile configuration

GCP Billing profile configuration

gcp_project_id: The unique identifier for your GCP project used to interact with it across services and APIs.

gcp_billing_account: The unique identifier for your GCP billing account to manage billing across projects.

For gcp_billing_account, all dashes (-) should be replaced with underscores (_).

Example:

gcp_billing_account: '015255_0E128B_3125S8'

gcp_service_account:The service account key used to authenticate and securely interact with Google Cloud APIs on your behalf.

gcp_dataset_id:The unique identifier assigned to a BigQuery dataset within a specific Google Cloud project.

Global discount for on-demand nodes

If you have a global discount for on-demand nodes (from a cloud provider or cloud reseller) that isn’t included in your custom cloud billing, you can apply it in addition to your GCP Cloud Billing integration.

Add the following parameters to your GCP Billing profile to enable applying the globalDiscount on top of your cloud billing integration:

global_discount (optional block):

  • percentage - the percentage (0–100, floats supported) of the discount to apply on top of standard on-demand node pricing. This field is required when global_discount exists.

  • start_date (optional) - the effective start date for applying the global_discount. If this field is empty, it defaults to today.

If you change the percentage or start_date, only newly generated Trends report will reflect the update. Historical reports will not update automatically. Contact [email protected] if you need them recalculated.

The complete configuration might look like the following example:

Profile configuration verification

To verify if the profile is configured properly, click the Test Integration button.

🟢 When the configuration is correct, you will see the message GCP Billing configured correctly.

🔴 In case of GCP Billing configured wrongly response, check the Show integration failure details dropdown and fix the displayed issue(s).

🛠️ How to apply GCP Billing profile

Apply to a single cluster

To apply GCP Billing profile to the cluster, go to the Overview tab on the left-hand panel -> find the cluster to which you want to apply the GCP Billing Profile and click gear dots button -> go to Customizations -> select the needed profile in the Pricing Profile drop-down list.

Applying GCP Billing profile to a single cluster

Apply to multiple clusters

To apply the profile to multiple clusters from a single view, use the Manage Assignments feature.

Go to the Settings tab on the left-hand panel -> select the Pricing -> click the Manage Assignments button -> apply the profile for the needed clusters -> click the Save Changes button.

Applying GCP Billing profile to multiple clusters

Configuring GCP pricing integration with CRD

To configure GCP pricing using a Custom Resource Definition (CRD), you’ll need to define and apply a Custom Resource (CR) that specifies your unique billing conditions. This approach allows you to manage accurate pricing directly through Kubernetes manifests.

Setup instructions

  1. Enable BigQuery billing export in your GCP project

  2. Create a service account with BigQuery Data Viewer permissions

  3. Generate a JSON key for the service account

  4. Copy the service account details and billing configuration to the CR.

CR configuration

⚙️ CR parameters:

Parameter
Description

global_discount (optional block)

The discount to apply on top of standard on-demand node pricing. percentage - the percentage (0–100, floats supported) of the discount. This field is required when global_discount exists. start_date (optional) - the effective start date for applying the global_discount.

gcp_billing_account

The unique identifier for your GCP billing account to manage billing across projects.

gcp_dataset_id

The unique identifier assigned to a BigQuery dataset within a specific Google Cloud project.

gcp_project_id

The unique identifier for your GCP project used to interact with it across services and APIs.

gcp_service_account

The service account key used to authenticate and securely interact with Google Cloud APIs on your behalf.

Last updated

Was this helpful?