Chapter 4 of 26
Billing Accounts, Budgets, and Cost Governance
Avoid surprise bills by mastering how billing accounts, budgets, and exports connect to projects and support cost control in enterprise environments.
Billing in Context: Why Cost Governance Matters
Why Cost Governance?
You now connect projects and IAM to a new layer: billing and cost governance. As an Associate Cloud Engineer, you must deploy resources confidently and prevent surprise bills.
Four Billing Pillars
Google Cloud billing centers on: 1) billing accounts, 2) linking projects, 3) budgets, alerts, and exports, and 4) quotas and governance patterns across many projects.
Exam-Style Scenarios
Expect scenarios like separating prod/test spending, exporting detailed cost data to BigQuery, or resolving Compute Engine quota errors when scaling a new service.
Module Outcomes
You will learn to create billing accounts, link/unlink projects, configure budgets and alerts, export billing data, and assess/request quota increases for core services.
Billing Accounts and Project Linkage
Types of Billing Accounts
Google Cloud uses self-serve accounts (card/bank) and invoiced accounts (pay by invoice). Both can pay for many projects; each project links to exactly one billing account.
Billing Account Properties
A billing account has a fixed currency and country, one or more payment profiles, and its own IAM roles that are separate from project-level IAM roles.
Billing IAM Roles
Key roles: Billing Account Creator, Administrator, User, and Viewer. IAM defines who has which role on the billing account resource.
Linking Projects
When you create a project, you must link it to a billing account. You can later reassign the project to another billing account without deleting the project.
What If Billing Is Disabled?
If a project loses its active billing account, billable resources stop but the project and data remain. This interruption without deletion is a frequent exam detail.
Hands-On: Creating a Billing Account and Linking a Project
Create a Billing Account
In the console, open Billing, click Create account, set name, country, and currency, choose or create a payment profile, and add a payment method.
Link a Project
Select your project, open Billing, then either link a new account or click Change billing account and choose the new billing account you created.
Effect of Linking
After linking, all new usage in that project is charged to the selected billing account; historical charges stay with the account that was active at the time.
Visual Model
Picture one billing account at the top with arrows to multiple projects, each containing resources. Resource usage flows upward into the single consolidated bill.
Budgets and Alerts: Preventing Surprise Bills
What Is a Budget?
A budget compares actual and forecasted costs against a target and triggers alerts. You can scope it to a billing account, projects, services, or labels.
Budget Amount and Period
Set a fixed amount, like USD 1000/month, or base it on last month’s spend. Budgets usually reset monthly but can use other periods.
Alerts, Not Kill Switches
Budgets send email and Pub/Sub notifications at thresholds (50%, 90%, 100%, etc.). They do not automatically stop resources or billing.
Using Pub/Sub
Connect budget alerts to Pub/Sub, then trigger Cloud Functions or Cloud Run to automate actions like scaling down or disabling projects.
Exam Reminder
On the exam, budgets = monitoring. Actual enforcement comes from governance: IAM, quotas, project separation, and any custom automation you build.
Configuring a Budget and Alert for a Project
Budget Scenario
You manage project `ace-lab-analytics` and want to keep monthly costs under USD 50, with early warnings as you approach that limit.
Create the Budget
In Billing → Budgets & alerts, create a budget, scope it to project `ace-lab-analytics`, set amount to 50 USD monthly, and add 50/90/100% thresholds.
Alert Behavior
As spend hits USD 25, 45, and 50, alerts fire via email and optionally Pub/Sub, giving you chances to review or automate cost-saving actions.
Automating Responses
A Cloud Function subscribed to the budget Pub/Sub topic can stop non-critical VMs, log events, or notify a chat channel when thresholds are reached.
Visualizing the Budget
Imagine a cost gauge from 0–50 USD with colored markers at 25, 45, and 50. Each marker represents a budget threshold and sends an alert.
Billing Exports and Reports: Seeing Where Money Goes
Billing Reports
The Billing → Reports page shows visual graphs of cost over time, broken down by project, service, SKU, and more, with filters for quick analysis.
Why Export?
Reports are great for quick views, but billing export gives you detailed, queryable data for dashboards, chargeback, and advanced analysis.
BigQuery Export
Standard usage cost export sends SKU-level cost and usage data to a BigQuery dataset, ideal for SQL queries and BI tools.
Cloud Storage Export
Cloud Storage export writes periodic CSV/JSON files for archiving or integration with external finance tools that read files.
Exam Associations
Need detailed, queryable billing data? Think BigQuery export. Need archived raw billing files? Think Cloud Storage export.
Configuring and Querying Billing Export (Conceptual Lab)
There is no heavy coding for billing export, but you should be comfortable with the workflow and simple BigQuery queries.
A. Configure BigQuery billing export (console steps)
- In Billing, select your billing account.
- Go to Billing export.
- Under BigQuery export, click Edit settings or Enable.
- Choose a project that will own the billing dataset (often a central "finops" project).
- Create or select a dataset, for example `billing_export`.
- Save. Google Cloud starts writing tables like `gcpbillingexportv1*` into that dataset.
B. Example BigQuery query
The following SQL answers: "Total cost by project for the last 30 days".
```sql
SELECT
project.id AS project_id,
ROUND(SUM(cost), 2) AS total_cost
FROM
`finops-project.billingexport.gcpbillingexportv1_*`
WHERE
usagestarttime >= TIMESTAMPSUB(CURRENTTIMESTAMP(), INTERVAL 30 DAY)
GROUP BY
project_id
ORDER BY
total_cost DESC;
```
C. Example: cost by label
If your teams tag resources with a label `team`, you can slice costs by that label.
```sql
SELECT
labels.key AS label_key,
labels.value AS label_value,
ROUND(SUM(cost), 2) AS total_cost
FROM
`finops-project.billingexport.gcpbillingexportv1_*`,
UNNEST(labels) AS labels
WHERE
labels.key = 'team'
AND usagestarttime >= TIMESTAMPSUB(CURRENTTIMESTAMP(), INTERVAL 30 DAY)
GROUP BY
label_key,
label_value
ORDER BY
total_cost DESC;
```
Even if you are not a SQL expert, recognize the pattern: billing export → BigQuery dataset → aggregate by project, service, or label.
Cost Governance Across Multiple Projects
Multi-Project Reality
In enterprises, you manage many projects. Cost governance combines hierarchy, IAM, and billing tools to keep spending controlled and visible.
Central Billing Pattern
A common pattern: one enterprise billing account, many projects. Use budgets per project or folder and a single BigQuery billing export.
BU-Based Billing
Some organizations use separate billing accounts per business unit or region, linking that BU’s projects to its own billing account.
Sandbox Guardrails
Sandbox projects live under a dedicated folder with lower quotas, strict IAM, and small budgets to limit risk and cost.
Chargeback and Labels
For chargeback/showback, think: labels/tags on resources, separate projects by team or env, and billing export to BigQuery for grouped reports.
Quotas and Quota Increase Requests
Purpose of Quotas
Quotas are limits on resource usage or API calls. They protect you from runaway costs and protect Google from abuse.
Quota Types
You will see resource quotas (CPUs, IPs, etc.) and API quotas (requests per minute/day), usually per project and often per region.
Viewing Quotas
Open IAM & Admin → Quotas, filter by service and metric, and review current usage, limits, and whether each quota is adjustable.
Requesting Increases
Select the quota, click Edit quotas/Request increase, set the desired limit, provide justification, and submit the request for review.
Quotas vs Budgets
Quotas limit how much you can use; budgets monitor how much you spend. Hitting a quota exceeded error calls for a quota increase request.
Thought Exercise: Designing a Cost-Safe Project Layout
Apply what you have learned by designing a simple cost governance plan.
Scenario
You are the first cloud engineer at a startup. You expect:
- A production web app with Compute Engine and Cloud SQL.
- A staging environment for testing.
- Several developer sandboxes.
You have one enterprise billing account.
Your task
Pause and sketch (mentally or on paper) answers to these questions:
- Project structure
- How many projects will you create?
- Which environments or teams get their own project?
- Budgets
- Where will you attach budgets (per project? per environment)?
- What approximate monthly budget would you set for each?
- What thresholds (percentages) will you alert on?
- Billing export
- Will you configure billing export to BigQuery, Cloud Storage, or both?
- Which project will own the billing export dataset or bucket?
- Quotas
- For production, do you need to request higher CPU quotas in the main region ahead of launch?
- For sandboxes, will you intentionally keep quotas low?
Reflection
After you have a rough plan, compare it against these guiding principles:
- Production in its own project, with higher quotas and tighter IAM.
- Staging and dev in separate projects with smaller budgets.
- Sandboxes in a dedicated folder with low quotas and clear budgets.
- One central billing export to BigQuery for all cost analysis.
This type of design question is very similar to what you might see in scenario-based exam items.
Quiz 1: Billing Accounts, Budgets, and Exports
Test your understanding of the core billing concepts.
You manage three projects (dev, test, prod) that must all be paid by the same legal entity. Finance wants detailed, queryable cost data by project and team label. Which setup is most appropriate?
- Create three separate billing accounts (one per project) and rely on monthly PDF invoices.
- Use a single billing account for all three projects, enable billing export to BigQuery on that account, and ensure resources are labeled by team.
- Use a single billing account, configure a budget for each project, and download CSV reports from the Reports page monthly.
- Create a billing account per team, link dev to one, test to another, and prod to both.
Show Answer
Answer: B) Use a single billing account for all three projects, enable billing export to BigQuery on that account, and ensure resources are labeled by team.
A single billing account for the same legal entity is typical. Enabling billing export to BigQuery at the billing account level gives detailed, queryable data that can be grouped by project and labels. Multiple billing accounts are unnecessary here, and budgets alone do not provide the detailed analysis finance requested.
Quiz 2: Quotas and Cost Controls
Check your understanding of quotas and budgets.
Your team launches a new service and receives errors when creating additional Compute Engine instances in us-central1 due to an exceeded CPU quota. What is the most appropriate next step?
- Increase the project’s monthly budget so more CPUs can be created.
- Request a CPU quota increase for the Compute Engine API in us-central1 from the Quotas page.
- Create a new project and move all resources there to reset the quotas.
- Disable billing on the project and then re-enable it to refresh the quota.
Show Answer
Answer: B) Request a CPU quota increase for the Compute Engine API in us-central1 from the Quotas page.
Quotas control how many resources you can use, independent of your budget. When you hit a CPU quota, you should request a quota increase for that metric and region. Budgets do not change quotas, and moving or toggling billing does not reset quota limits.
Flashcards: Key Terms for Billing and Governance
Use these flashcards to reinforce the most important terms from this module.
- Billing account
- A Google Cloud billing entity that holds payment methods and pays for usage from one or more linked projects. Each project can link to only one billing account at a time.
- Budget
- A configuration on a billing account that tracks actual and forecasted costs against a target amount and triggers alerts (email/Pub/Sub) when thresholds are reached.
- Billing export to BigQuery
- A feature that continuously exports detailed cost and usage data from a billing account into a BigQuery dataset for SQL-based analysis and reporting.
- Billing export to Cloud Storage
- A feature that writes periodic CSV/JSON billing data files from a billing account into a Cloud Storage bucket, useful for archiving or external integrations.
- Quota
- A limit on resource usage or API calls (often per project and region) that protects against accidental overuse and abuse. Some quotas are adjustable via requests.
- Quota increase request
- A request submitted from the Quotas page to raise the limit for a specific metric (such as CPUs in a region), including justification and desired new value.
- Billing Account User role
- An IAM billing role that allows a principal to attach projects to a billing account but not to manage payment methods or account-level settings.
- Billing reports
- Visual reports in the Billing section of the console that show costs over time and breakdowns by project, service, SKU, and other dimensions.
- Cost governance
- The combination of resource hierarchy, IAM, budgets, quotas, labels, and exports used to control, monitor, and allocate cloud spending across an organization.
- Project-level cost isolation
- A governance practice where different environments or teams use separate projects so that their costs, IAM policies, and quotas can be managed independently.
Key Terms
- Quota
- A limit on resource usage or API calls (often per project and region) that protects against accidental overuse and abuse.
- Budget
- A configuration on a billing account that tracks actual and forecasted costs against a target amount and triggers alerts when thresholds are reached.
- Labels
- Key-value metadata attached to many Google Cloud resources, often used for organizing and grouping costs in billing reports and exports.
- Billing export
- A feature that sends detailed cost and usage data from a billing account to BigQuery or Cloud Storage for analysis or archiving.
- Billing account
- A Google Cloud billing entity that holds payment methods and pays for usage from one or more linked projects. Each project can link to only one billing account at a time.
- Billing reports
- Visual cost reports in the Google Cloud console showing cost over time and by dimensions like project, service, and SKU.
- Cost governance
- The set of practices and tools used to control, monitor, and allocate cloud spending across projects and teams.
- Billing Account User
- An IAM billing role that allows a principal to attach projects to a billing account but not change payment methods or core billing settings.
- Quota increase request
- A request submitted from the Quotas page to raise the limit for a specific metric, such as CPUs in a region.
- Project-level cost isolation
- The practice of using separate projects to isolate costs, IAM policies, and quotas for different environments or teams.