Skip to main content

Set-up documentation Google Cloud Platform x Costory

Integrating GCP billing data – Onboarding Guide

Grégoire Blond avatar
Written by Grégoire Blond
Updated over 3 months ago

This document will help you:

  • Create a Detailed billing export in the GCP Console

  • Share your billing data with Costory

  • Answer frequently asked questions

You will only need to provide in Costory:

  • Table path in BigQuery

Prerequisites:

  • Costory has provided you with a service account to share your billing data with in the welcome email. It will have the following format

    costory-<CLIENTNAME>@costory-production.iam.gserviceaccount.com

Step 0: If GKE cluster

If you have a GKE cluster (autopilot or not): Enable the cost allocation: it will allow to have a better visibility on your Kubernetes workload: https://cloud.google.com/kubernetes-engine/docs/how-to/cost-allocations#console_1

Step 1: Find your Billing Export

The ideal (and recommended by GCP) situation is that you already have a detailed billing export set up from as soon as you set up your GCP account.

  1. On your billing project go to billing export page

  2. Check that the Detailed Usage Cost is enabled.

    If it is disabled, you will need to create one

  3. Check that the region of the dataset is EU by clicking on it

    If not, please set up a replica

  4. Capture the full path of the table by clicking on the toggle on the dataset

  5. If you only have a standard billing export enabled please share it with us (follow step 2), but you should also create a detailed billing export: we will use the standard billing for the previous months and use detailed billing data from now on.

Step 2: Share the billing data with us

Click on the dataset name, you should be redirected to BigQuery:

Click on Sharing and click on permissions: then Add new principals

Use the service account name, Costory provided you: this is your personal service account which only allows access to your data.

Add the following two IAM roles:

  • BigQuery Data viewer: to be able to read all the tables in the dataset.

  • BigQuery metadata viewer: to be able to list tables in the dataset.

Step 3: Configure the GCP Billing Datasource in Costory

The table name should look like: gcp_billing_export_resource_v1_<billing_account_id>.

  • Click on Import New Billing Datasource

  • Select GCP

  • Provide all the config required.

  • Unless instructed by support, ignore Start & End Date

  • Click Next, this will test the configuration.

  • Click Import

  • Save

Note. It can take a few days to backfill the current month.

FAQ

How to set up a replica on the EU region ?

you can create a read-only replica in EU

  1. View the dataset in BigQuery

  2. At the bottom of the dataset info panel, click View replicas

  3. Click Create replica

  4. Select EU as the region

How to create a new billing export ?

If you don't have a currently setup billing export, follow the steps in the following GCP documentation to set up one.

Important information :

  • Select EU for the dataset location (not a sub-zone)

  • You will need to run thru the process for each of your billing account id

  • Read the backfill caveat below

I don't have historical data, how can I get a backfill ?

If contracting directly from GCP

GCP will backfill the current month of data, it can take a few days to appear. However GCP won’t backfill the invoices from before you enabled the export

Contact us about the potential mitigations options via the intercom Messenger.

If contracting via a Reseller

Contact your reseller (ideally put us in cc so that we can make sure it happens) so that they run a BQ query to export your relevant historical data from their master billing account id.
Reference Documentation https://cloud.google.com/channel/docs/rebilling/example-export-queries

Did this answer your question?