Connecting Google Cloud to CostReveal, setup guide
The CostReveal team, , 7 minute read
Google Cloud bills by invoice month, with late usage, credits and discounts woven through it, and none of that says which team or customer the spend was for. This guide covers how CostReveal reads Google Cloud spend from your billing account's detailed export to BigQuery, what you need first, each setup step, how labels explain spend, how Gemini and Vertex AI appear, and how every invoice month is checked against the export's own total.
What the Google Cloud connection reads
CostReveal reads your billing account's detailed usage cost export to BigQuery, in a dataset in your own project. That export holds every line Google bills: the service, SKU, region, resource, labels, credits and the invoice month each line belongs to.
Nothing is installed in your workloads and no key is exchanged. CostReveal's own service account is granted read access to that one dataset, and permission to run its queries in your project, so the queries are billed where your data is. It can read nothing else. If you also export Recommender's recommendations to the same dataset, CostReveal lists their cost savings under Insights, Savings.
What you need
- The Billing Account Administrator or Billing Account Costs Manager role on the billing account, to turn on the export.
- A project linked to that billing account, holding the BigQuery dataset the export writes to, and permission to grant roles in it.
- An owner or admin role in CostReveal.
Step by step setup
1. Turn on the detailed export
In the Google Cloud console, open Billing, Billing export. Under BigQuery export, turn on Detailed usage cost into a dataset. The detailed export is the one that carries resource level lines; the standard export does not.
A dataset in the US or EU multi-region also brings in the previous month. The first data can take a few hours to appear, and that backfill up to five days.
2. Start the connection
In CostReveal, go to Connections and choose Connect Google Cloud. CostReveal shows its own service account, and the two grants to give it, filled in as you type the project and dataset.
3. Grant the service account two roles
- BigQuery Data Viewer on the dataset, so it can read the export.
- BigQuery Job User on the dataset's project, so its queries run, and are billed, where your data is.
Nothing broader is needed. The service account cannot read any other dataset or change anything.
Optionally, export Recommender's recommendations to BigQuery into the same dataset, in the Google Cloud console. It is set up once for the organization, by someone with the recommender.resources.export permission there, and needs nothing more for CostReveal. Once a day CostReveal reads the newest day's active cost recommendations, such as machine types to change, idle resources and commitments to buy, for the projects your billing account pays for and the account itself, each with what Recommender estimates it saves.
4. Verify and connect
Enter the billing account ID, the project, the dataset and its location, and choose Verify and connect. Only the format is checked as you type. When you verify, CostReveal queries the export before saving anything, and points at the field to fix if it cannot.
How often it reads, and how much history
Google appends to the export through the day, and some usage takes more than a day to arrive. CostReveal reads it every four hours. The first read brings in the current invoice month and the twelve before it, as far as the export holds them. Where the export holds no older months, Connections says how far back it reached, and each read asks again. After that, each read covers the current and previous month.
To keep its queries small, CostReveal first reads a short summary of each month, and reads a month in detail only when Google has appended to it since, and then only the days its rows lie in.
Connection states
Under Connections, the connection is always in one of four states:
- Setup not finished: the details have not been verified yet.
- Waiting for first data: everything was verified, and the export has no data yet.
- Connected: the export was read and the latest read succeeded.
- Needs attention: the latest read failed, for example because a grant was taken back. Everything already read is kept.
How Google Cloud spend is explained
- Direct: the service, which Google reports itself. Each line also keeps its SKU, region and resource.
- Inferred: the team, feature and customer, when a label names them. Labels are read with the project's tag keys, the same way tags are for AWS: first the resource's own labels, then its project's labels for any key the resource does not carry. So a project labelled
team: searchexplains every resource in it that has no team label of its own. - Allocated: a share of a cost an allocation rule divides, by fixed percentages, evenly, or in proportion to what each owner's labels already explain.
- Unknown: spend no label or rule explains. It is shown as unknown, never spread across teams.
Gemini and Vertex AI
Gemini calls on Vertex AI can carry labels on each request, and Google passes those labels into the bill. Label each call with the customer or feature it is for, and that spend is explained by them straight from the invoice, with no other data needed.
Google's export names models only in SKU descriptions, so Google Cloud spend has no model in CostReveal, and usage data does not divide it among your customers today.
How figures are checked
Two checks run on every month.
The ledger against attribution. Every amount is summed exactly, the way Google's own invoice query does, never as a floating point number. The invoice month is the period, as on Google's invoice; late usage that Google bills in the next month is filed there, under the day it happened. Credits, such as sustained use and committed use discounts, promotions and free tier, are their own lines, by kind, so gross and net spend both show. Tax and adjustments are kept as Google reports them. Attribution on every dimension must add up exactly to those lines.
The ledger against the export's own total. Each month's lines must add up to the export's total for the invoice month, read separately across the whole table. Until the month ends, a difference is pending. After that, it is flagged as a variance, never adjusted away.
A change Google makes to a month already read is recorded as a correction that keeps what was said before, and attribution runs again.
Getting more of Google Cloud spend explained
- Label projects first. Project labels explain every resource in them that has no label of its own, so a project per team or product gets far with a few labels.
- Use the keys you already have. If you label
ownerordepartment, those are among the default keys; others can be added under the project's tag keys. - Label Vertex AI requests with the customer or feature, so AI spend is explained by who it served.
- Write allocation rules for shared projects, so shared platforms are allocated in the open rather than left unknown.
Troubleshooting
- Verify cannot find the dataset. Check the project, dataset and its location, and that BigQuery Data Viewer was granted on that dataset to CostReveal's service account.
- Verify cannot run a query. Grant BigQuery Job User on the dataset's project.
- Waiting for first data for hours. The export's first data can take a few hours. A dataset outside the US or EU multi-region does not bring in the previous month.
- A labelled project's spend shows as unknown. Check the label key is one of the project's tag keys, and that the label is on the project rather than only on a folder.
Removing the connection
Removing the connection under Connections deletes every figure it brought in from the project, and its archived reports are deleted within a day. Take back the service account's two grants in Google Cloud too. To stop reading without removing anything, take back the grants: CostReveal keeps every figure already read and tells you new data has stopped.
Frequently asked questions
Which export does CostReveal need? The detailed usage cost export to BigQuery. It carries resource level lines, which the standard export does not.
What can CostReveal's service account access? Only the export's dataset, with BigQuery Data Viewer, and query jobs in that dataset's project, with BigQuery Job User. It cannot read any other dataset or change anything.
Who pays for CostReveal's queries? They run in your project, so they are billed there. CostReveal reads a short summary first, and only the days that changed in detail, to keep them small.
How much history is brought in? The first read covers the current invoice month and the twelve before it, as far as the export holds them. A dataset in the US or EU multi-region also backfills the previous month when the export is turned on.
Why does Gemini spend have no model? Google's export names models only in SKU descriptions. Labels on Vertex AI requests can still explain that spend by customer or feature.
How is late usage handled? It is filed in the invoice month Google bills it in, under the day it happened, as on Google's invoice.
Keep reading
- Connecting AWS to CostReveal: the Cost and Usage Report and cost allocation tags.
- Connecting Azure to CostReveal: a FOCUS export and tag inheritance.
- Connect Google Cloud in the docs: the reference for every setup step.