Skip to main content

Billing

Exam guide§1.2

A billing account pays for usage. Projects don't pay - they link to a billing account, and one billing account can pay for many projects. Billing lives outside the resource hierarchy: it is its own object with its own IAM roles.

How consumption rolls up

Billing is read from the bottom of the resource hierarchy up. Each resource belongs to exactly one project, so a project accumulates the consumption of all its resources. Each project links to one billing account, and the organization contains every billing account. This is the mirror image of IAM: policies are inherited top-down, while consumption and billing accumulate bottom-up.

Google CloudOrganizationFoldersProjectsResourcesVM instanceIdentity and Access ManagementIAM allow and deny policiesBilling and Resource MonitoringOrganization contains all billingaccountsProject is associated with onebilling accountA resource belongs to one andonly one project
Consumption accumulates bottom-up: a resource's usage rolls into its one project, each project links to one billing account, and the organization holds every billing account - the mirror image of IAM policies, which are inherited top-down.

Linking projects

A project with no billing account attached cannot create billable resources. Moving a project between billing accounts is a single operation and doesn't disturb the resources.

CommandsLink and inspect
gcloud billing accounts list
gcloud billing projects link my-proj-id --billing-account=XXXXXX-XXXXXX-XXXXXX
gcloud billing projects describe my-proj-id
FactsBilling roles (these are on the billing account, not the project)
  • Billing Account Administrator - full control, link/unlink projects
  • Billing Account User - can link projects to this account (the role you grant devs)
  • Billing Account Viewer - read cost data only
  • Project Billing Manager - links/unlinks a project without seeing billing data
GotchaSeparation of duties

"A developer must create projects and attach them to billing, but must NOT see company spend" = Billing Account User (on the account) + Project Creator (on the org). Never the Administrator role. This split-permission scenario is heavily tested.

Subaccounts and invoicing

Billing accounts are charged automatically and invoiced monthly, or sooner if spend reaches a threshold limit. A billing subaccount splits billing out by project while still rolling up to one parent billing account.

GotchaSubaccounts are for resellers

The classic use case: a partner who resells Google Cloud creates one subaccount per customer, so each client's usage is invoiced separately but consolidated under the reseller's billing account. "Separate billing per customer/project under one account" = subaccounts.

Budgets and alerts

A budget does not cap spend - it only triggers alert notifications (email, or Pub/Sub for automation) at threshold percentages. There is no built-in "hard stop."

You create one in three parts: Scope (name + which projects it covers), Amount, and Actions (the alert thresholds).

1ScopeNameBudget NameProjectsAll projects (2)2AmountBudget typeSpecified amountA fixed amount your spend is compared against.Target amount$ 500SpecifiedLast month3ActionsPercent of budgetAmountTrigger on50%$ 250Actual90%$ 450Actual100%$ 500ForecastedActualForecasted
Creating a budget: (1) Scope it to a name and projects, (2) set the Amount to a specified figure or to last month’s spend, (3) add alert Actions at percent thresholds - each firing on Actual spend or Forecasted end-of-period spend.
NumbersBudget amount and alert options
  • Amount is either a specified amount (a fixed figure) or last month's spend (the budget re-baselines each month automatically).
  • Alert thresholds are percentages of the amount - e.g. 50%, 90%, 100% - and each can also carry a dollar figure. Alerts email the Billing Admins when spend crosses a threshold.
  • Trigger on is Actual (spend so far) or Forecasted (projected end-of-period spend).
  • Beyond email, a budget can publish to a Pub/Sub topic for programmatic handling.
CompareForecasted alerts fire before you overspend
ActualOnly fires after spend has already crossed the threshold.
ForecastedFires when Google projects you will cross it by the end of the budget period - warned early, while there is still time to act.

"Alert me before I'm going to blow the budget, not after" = Forecasted.

The alert email names the project, the percent of the budget exceeded, and the budget amount - enough to see at a glance which project needs attention.

GotchaBudgets never stop spending

The single most common billing trap: a budget of $100 does not shut anything off at $100. To actually stop resources you wire the budget's Pub/Sub notification to a Cloud Function that disables billing on the project. If the question says "prevent all further charges," the answer involves Pub/Sub + a function, never the budget alone.

Billing export to BigQuery

For anything beyond the console's built-in reports - custom queries, chargeback per team, long-term analysis - enable billing export to BigQuery. Detailed usage rows stream into a dataset you own, where SQL turns raw line items into answers.

Billing accountenable export, pick oneBigQuery datasetusage rows stream inSELECT *SQL querycost > 0, latest N, …Cost insighttrends, chargebackCloud StorageCSV / JSON file in a bucket
Billing export is a branch, not a chain: the admin picks one destination. Usage rows stream directly into a BigQuery dataset for SQL analysis, or a CSV / JSON file is written to a Cloud Storage bucket. There is no bucket step in front of the BigQuery path.

Once the data lands it is just a table: filter to rows with cost > 0, pull the latest N charges, or total everything over a threshold. The value is in repeating those queries over time.

FactsWhat the export lets you answer
  • Where spend concentrates - break down by service, SKU, project, or label
  • How consumption trends - compare usage across days/months to spot growth
  • Capacity planning - the trend is the input: scale up for growth, down for efficiency
  • Chargeback / reporting - answer leadership's "what did team X cost?" from real line items
CompareTwo export destinations - BigQuery vs a file

On the Billing export screen you pick one of two independent targets.

BigQueryStreams detailed usage rows for SQL and ongoing analysis.
File exportWrites a CSV or JSON file to a Cloud Storage bucket - a lightweight, shareable snapshot with no dataset to manage.

If a question asks which formats billing data exports to, the answer is CSV or JSON.

Visualize and optimize spend

Because labels propagate through billing, you can slice the export by any dimension you tag - and the slices point to savings. Label VM instances by region and you might spot instances sending most of their traffic to a distant continent: relocate them closer to users, or front them with Cloud CDN to cache content at the edge, cutting networking spend.

For a shareable view, point Looker Studio at the exported BigQuery data. It turns raw line items into customizable dashboards - daily, monthly, and by-project - that you can slice by your labels.

Billing DashboardDaily ViewToday’s Spend by ServiceMonthly ViewMonth-to-Date Spend by ServiceOverallMonth-to-Date Spend by ProjectLooker Studio
A Looker Studio billing dashboard built on your exported BigQuery data: today’s spend by service, month-to-date by service, and month-to-date by project - one shareable, sliceable report.

Recap

DECISIONHow do I answer this cost question?
"Am I trending over budget?"Budget + alert
"Break spend down by label / service / SKU"Billing export → BigQuery
"Quick glance at this month"Console billing reports
"Automatically react to spend"Budget → Pub/Sub → Cloud Function
Pick this when: reach for the lightest tool that answers it