GCP Billing Budgets and Alerts: Setup, Thresholds, and Pub/Sub Automation
A GCP billing budget is a monthly spending target that sends you alerts when your cloud costs reach thresholds you define. Budgets do not stop your services or block new deployments. They are notifications only. If costs exceed your budget, everything keeps running and charges continue to accumulate unless you take action.
This page is for anyone setting up cost monitoring in Google Cloud for the first time. You will learn what budgets do and do not do, how to create one in the Console and with the CLI, how to choose useful thresholds, where alerts are delivered, and how to optionally automate follow-up actions with Pub/Sub.
Simple explanation
Budgets are like data usage alerts on your phone plan
Your phone carrier sends you a text when you hit 80% of your data allowance. That text does not cut off your data. You can keep browsing, and you will be charged for overages. The alert just tells you where you stand so you can decide what to do.
GCP billing budgets work the same way. You set a monthly dollar amount and pick the percentage thresholds where you want to be notified. When actual or forecasted costs cross those thresholds, GCP sends an email. Your services keep running regardless.
The analogy breaks down in one important way: your phone carrier can hard-cap your data. GCP budgets cannot hard-cap your spending. If you need automatic shutdowns, you have to build that yourself using Pub/Sub and a Cloud Function, which this page covers in a later section.
Every beginner should create at least one budget before deploying any resources. It takes two minutes in the Console and costs nothing. The alternative is discovering unexpected charges on your credit card statement days or weeks later.
What billing budgets do and do not do
This is the single most misunderstood aspect of GCP cost management. Beginners often assume that setting a budget will prevent overspending. It will not.
A billing budget does not stop your services when the limit is reached. Your VMs keep running, your queries keep executing, and your bill keeps growing. A budget is a notification tool, not a spending cap.
| Mechanism | What it does | Does it stop usage? |
|---|---|---|
| Billing budget | Sends email or Pub/Sub notifications when spending crosses a threshold | No |
| Quota | Limits resource consumption (API calls, CPUs, storage) at the project or region level | Yes, blocks requests when reached |
| Pub/Sub automation | Triggers a Cloud Function when a budget alert fires, which can stop VMs or disable billing | Only if you build and deploy the function yourself |
GCP processes billing data asynchronously. Current-spend alerts can lag by several
hours. A runaway BigQuery query or an accidentally oversized VM deployment can incur
significant charges before any alert fires. For real-time guardrails on specific
services, use quotas or per-query limits like
maximumBytesBilled on BigQuery jobs.
Before you create a budget
Make sure the following are in place before you start.
You need a billing account
Budgets are created on a billing account, not on a project directly. If you are using the GCP free trial, you already have a billing account. You can find it in the Console under Billing. The billing fundamentals guide explains how billing accounts and projects relate.
You need the right permissions
To create or edit budgets you need roles/billing.admin or
roles/billing.costsManager on the billing account. Billing Account
Viewer can see budgets but cannot create or modify them. If you are the account
owner, you already have the necessary access.
Where budgets are managed
In the Console: Billing → Budgets & Alerts. In the CLI:
gcloud billing budgets commands. Budgets live at the billing account
level but can be scoped down to specific projects, services, or labels.
What scopes are available
- Entire billing account: tracks total spend across all linked projects
- Specific projects: one or more projects within the billing account
- Specific services: only charges from a named service, like BigQuery or Compute Engine
- Labels: only resources tagged with a specific label, like
team=alphaorenv=dev
Starter budget examples
If you are not sure what amount to set, start with these and adjust as you learn your usage patterns:
- Personal learning or free trial: $25 to $50 per month
- Dev or staging environment: $100 to $300 per month
- Small production workload: $500 to $1,000 per month
You can change the amount at any time. The estimating cloud costs guide walks through how to forecast spend before deployment.
How to set up a billing budget in the Console
The Console is the easiest way to create your first budget. The full process takes about two minutes.
Open the Google Cloud Console and go to Billing → Budgets & Alerts.
Click Create Budget.
Name your budget. Use a descriptive name like “Dev Project Monthly Budget” or “BigQuery Production Budget”. You will see this name in alert emails.
Set the scope. Under “Scope”, choose whether this budget covers the entire billing account, specific projects, specific services, or label-filtered resources. For a first budget, scoping it to your main project is a good starting point.
Set the budget amount. Enter a monthly dollar amount. You can also choose “Last month’s spend” to automatically track against the previous month, but a fixed amount is clearer for beginners.
Add threshold rules. Add at least two thresholds. A practical starting set is 50% current spend, 90% current spend, and 100% forecasted spend. You can add up to five thresholds per budget.
Configure alert recipients. By default, alerts go to billing account admins and users. You can also add Cloud Monitoring notification channels (email, Slack, PagerDuty) or connect a Pub/Sub topic for automation.
Click Finish. The budget is active immediately.
Create separate budgets for dev, staging, and production. A forgotten Cloud SQL instance or oversized VM in a dev project can quietly accumulate hundreds of dollars a month without anyone noticing.
How to create a billing budget with gcloud
The CLI is useful when you manage multiple budgets, need to script budget creation across projects, or want to version-control your budget configuration in a deployment pipeline.
# Create a budget for a specific project with a $500 monthly limit
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="Production Project Budget" \
--budget-amount=500USD \
--projects=projects/my-project-id \
--threshold-rule=percent=50,basis=current-spend \
--threshold-rule=percent=90,basis=current-spend \
--threshold-rule=percent=100,basis=forecasted-spendThis creates a $500 budget with alerts at $250 (50% current), $450 (90% current), and whenever the forecasted end-of-month total is projected to exceed $500.
# List all budgets on a billing account
gcloud billing budgets list \
--billing-account=BILLING_ACCOUNT_ID
# View the full configuration of a specific budget
gcloud billing budgets describe BUDGET_ID \
--billing-account=BILLING_ACCOUNT_IDReplace BILLING_ACCOUNT_ID with your actual billing account ID. You can
find it in the Console under Billing → Account Management or
by running:
# List billing accounts you have access to
gcloud billing accounts listChoosing useful threshold rules
A single threshold at 100% means you only find out after the budget is fully consumed. By then it is too late to investigate or react. Multiple thresholds give you a series of escalating signals.
Think of thresholds like a fuel gauge
Your car does not wait until the tank is empty to warn you. The gauge shows half-full, then quarter-full, then the low fuel light comes on. Each stage gives you a different amount of time to react. Budget thresholds work the same way: multiple levels give you progressively more urgent signals before the money runs out.
A practical three-threshold setup:
50% current spend: early warning. No action required, but it confirms that billing is being tracked. If this fires in the first week of the month, something may be wrong.
90% current spend: investigate now. Review your cost breakdown reports and identify which resources are driving the spend.
100% forecasted spend: fires mid-month if your current run rate projects to exceed the budget by month end. This is your earliest actionable signal because it fires before the budget is actually consumed.
You can set thresholds above 100%. A threshold at 150% fires when actual spend reaches 1.5 times the budget amount. This is useful as a secondary escalation if the 100% alert was missed or not acted on.
Current spend vs forecasted spend
GCP supports two threshold basis types and they behave differently:
| Basis type | When it fires | Best for |
|---|---|---|
| Current spend | When actual incurred charges reach the threshold percentage | Confirmed cost tracking: telling you what has already been spent |
| Forecasted spend | When GCP projects that end-of-month spend will exceed the threshold | Early warning: catching accelerating costs before the budget is consumed |
Current-spend alerts are backward-looking and can lag by several hours due to billing data processing delays. Forecasted-spend alerts are forward-looking and often fire earlier in the month if costs are rising faster than expected. Set current-spend thresholds for confirmed tracking and a forecasted-spend threshold for early detection.
Where budget alerts go
By default, budget alerts are sent as email notifications to users with the Billing Account Administrator or Billing Account User role. You can extend this in two ways.
Cloud Monitoring notification channels
You can route alerts to any notification channel configured in Cloud Monitoring, including email addresses, Slack channels, PagerDuty, SMS, or webhooks. Create the notification channel first in Cloud Monitoring, then reference it in the budget.
# Update a budget to send alerts to a Cloud Monitoring notification channel
gcloud billing budgets update BUDGET_ID \
--billing-account=BILLING_ACCOUNT_ID \
--all-updates-rule-monitoring-notification-channels=\
projects/my-project/notificationChannels/CHANNEL_IDRouting alerts to a team Slack channel is more reliable than a general email list. Emails get buried. Slack messages in a dedicated cost-alerts channel are visible and create accountability.
Pub/Sub topic
Connecting a budget to a Pub/Sub topic enables programmatic automation. When a threshold is crossed, GCP publishes a JSON message to the topic containing the budget name, threshold percentage, cost amount, and budget amount. A Cloud Function or Cloud Run service subscribed to that topic can take automatic action. This is covered in detail in the next section.
Optional: automate follow-up actions with Pub/Sub
If you want something to happen automatically when a budget threshold is crossed, you need to connect the budget to a Pub/Sub topic and write a function that responds to the published message. This is entirely optional. Most beginners start with email alerts only and add automation later.
Step 1: Create a Pub/Sub topic
# Create a dedicated topic for budget notifications
gcloud pubsub topics create billing-budget-alertsStep 2: Create a budget with Pub/Sub notification
# Create a dev budget that publishes alerts to the topic
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="Dev Budget with Auto-Stop" \
--budget-amount=100USD \
--projects=projects/dev-project-id \
--threshold-rule=percent=100,basis=current-spend \
--pubsub-topic=projects/my-project/topics/billing-budget-alertsYou can also connect an existing budget to a Pub/Sub topic in the Console by editing the budget and adding the topic under the “Actions” step.
Step 3: Deploy a Cloud Function that responds to the alert
A common automation pattern is stopping non-critical VMs when a dev budget is exceeded. The following Cloud Function checks whether spending has reached 100% of the budget and logs the event:
# Cloud Function triggered by Pub/Sub budget alert
import base64
import json
from googleapiclient import discovery
def stop_vms_on_budget_exceeded(event, context):
"""Stop non-critical VMs when budget threshold is reached."""
pubsub_message = base64.b64decode(event['data']).decode('utf-8')
budget_data = json.loads(pubsub_message)
cost_amount = budget_data.get('costAmount', 0)
budget_amount = budget_data.get('budgetAmount', 1)
if cost_amount / budget_amount >= 1.0:
print(f"Budget exceeded: spent {cost_amount} of {budget_amount}")
# Add your VM stop logic here using the Compute Engine API
# Example: stop all VMs with label env=devTarget only VMs labeled env=dev or resources in a dedicated
non-critical project. Stopping production resources in response to a budget alert
causes an outage, which is almost always worse than the cost it prevents.
Other automation patterns include disabling billing on a project to halt all charges, sending a detailed Slack message with a cost breakdown, or creating a Jira ticket for the team that owns the over-budget project.
Per-project, per-service, and per-team budgets
A single billing account can hold up to 5,000 budgets. Use scoped budgets to give each team, environment, or service its own spending visibility.
Per-service budget
# Budget for BigQuery charges only, across all projects
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="BigQuery Monthly Budget" \
--budget-amount=200USD \
--services=services/95FF-2EF5-5EA1This is useful for high-cost services like BigQuery, Compute Engine, or Cloud SQL where a single team or query pattern can drive most of the bill. See the BigQuery cost optimisation guide for how to reduce BigQuery spending specifically.
Per-team budget using labels
# Budget for all resources labeled team=alpha
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="Team Alpha Budget" \
--budget-amount=500USD \
--credit-types-treatment=EXCLUDE_ALL_CREDITS \
--label=team=alphaLabel-based budgets only work if resources are consistently labeled. Enforce
team, env, and app labels on all resources
using organisation policy or Terraform. The
identifying
expensive resources guide explains how label data flows into billing queries.
A tiered budget structure for organisations
For organisations with multiple teams and projects, a three-tier structure provides complete coverage:
Billing account budget: total monthly spend ceiling for organisation-level visibility
Per-project budgets: each project has its own budget aligned to the team that owns it
Per-service budgets: high-cost services like BigQuery and Cloud SQL get dedicated budgets for service-level accountability
This structure aligns well with the FinOps principles of shared cost accountability and is a core part of any cost optimisation strategy.
Billing budgets vs quotas in GCP
Budgets and quotas are often confused because both involve limits. They serve completely different purposes.
Smoke detector vs sprinkler system
A billing budget is like a smoke detector. It sounds an alarm when something is wrong, but it does not put out the fire. A quota is like a sprinkler system. When resource usage hits the limit, the quota blocks further consumption automatically. You want both in the building.
| Billing budget | Quota | |
|---|---|---|
| What it limits | Nothing. It monitors spending | Resource consumption (API calls, CPUs, storage, etc.) |
| Enforcement | Sends notifications only | Blocks requests when the limit is reached |
| Where configured | Billing → Budgets & Alerts | IAM & Admin → Quotas |
| Scope | Billing account, project, service, or label | Project and region |
| Typical use | Cost awareness and financial planning | Preventing runaway resource provisioning |
A budget tells you when costs are rising. A quota prevents a misconfigured deployment from spinning up 1,000 VMs before anyone notices. Neither one replaces the other.
When to use this
This is the single most effective habit for avoiding surprise charges as a beginner. A forgotten VM, an unoptimised BigQuery query, or an open Cloud SQL instance can generate real charges within hours. Two minutes now saves real money later.
When multiple teams share a billing account. Per-project and per-label budgets give each team visibility into their own spending without needing separate billing accounts.
When running dev or staging environments. Non-production environments often accumulate unnoticed costs from forgotten resources. A budget with a low threshold catches this early.
When a specific service drives most of your bill. A dedicated BigQuery or Compute Engine budget helps you track whether Compute Engine optimisations or BigQuery cost controls are actually working.
When you need automated cost responses. Connecting a budget to Pub/Sub lets you build automated workflows that react to spending changes without human intervention.
Common mistakes
Assuming the budget will stop services automatically. It will not. Budget alerts are notifications only. If you need automatic cost control, build the Pub/Sub automation described above or use quotas. Do not discover this after a surprise bill.
Setting only a single 100% threshold. A single alert at 100% means you find out only after the budget is fully consumed. Add a 50% early-warning alert and a 90% action alert so you have time to investigate before costs get out of control.
Treating budget alerts as real-time. Current-spend alerts can lag by hours. Do not rely on them to catch a runaway BigQuery query or an accidentally large VM. For real-time control, set
maximumBytesBilledon BigQuery jobs or use quota policies.Sending alerts to a group inbox that nobody monitors. Budget alert emails routed to a general team address often go unread. Route alerts to a dedicated Slack channel or a named individual who is accountable for acting on them.
Not creating budgets for non-production environments. Dev and staging projects frequently accumulate costs from unused resources that no one is watching. A $100 budget on a dev project catches problems that a production-only budget misses entirely.
Stopping production VMs in automated budget responses. If you build Pub/Sub automation, scope it to non-critical resources only. An automated response that takes down production is almost always worse than the cost it was trying to prevent.
Summary
- A billing budget is a monthly spending target that sends alerts but does not stop services or block usage
- Set at least three thresholds: 50% current spend (early warning), 90% current spend (investigate), 100% forecasted spend (early detection)
- Create budgets before deploying your first resource, not after your first surprise bill
- Budget alerts can lag by hours because billing data is processed asynchronously
- Route alerts to a monitored Slack channel or named individual, not a general email list
- Use scoped budgets by project, service, or label to give each team its own cost visibility
- For automatic responses, connect the budget to a Pub/Sub topic and deploy a Cloud Function
- Budgets and quotas serve different purposes: use both together for complete cost control
Frequently asked questions
Does a GCP billing budget automatically stop services when the budget is exceeded?
No. A billing budget only sends notifications by default. Your services continue running and charges keep accumulating after any threshold is crossed. To stop services automatically you need to connect the budget to a Pub/Sub topic and deploy a Cloud Function that shuts down the relevant resources when it receives the alert message. Budgets are a monitoring tool, not a spending cap.
Can I set a billing budget for just one project or one service?
Yes. When you create a budget you can filter it by project, by a specific GCP service such as BigQuery or Compute Engine, or by a resource label like team=alpha. The budget is defined at the billing account level but its scope can be as narrow as a single service inside a single project. This makes it practical to give each team or environment its own separate budget.
How quickly does GCP send a budget alert after costs cross a threshold?
Current-spend alerts can lag by several hours because GCP billing data is processed asynchronously, not in real time. Forecasted-spend alerts may fire earlier in the month because they project your current run rate forward. For near-real-time cost monitoring, export billing data to BigQuery and query it directly, or set per-query limits like maximumBytesBilled on BigQuery jobs.
What is the difference between a billing budget and a quota in GCP?
A billing budget tracks spending and sends notifications when thresholds are crossed but does not restrict usage. A quota is a hard limit on resource consumption, such as the number of API calls per minute or the number of CPUs in a region. Quotas block usage when reached. Budgets and quotas serve different purposes and are managed in different parts of the Google Cloud Console.
How many billing budgets can I create on one billing account?
You can create up to 5,000 budgets per billing account. This is more than enough for most organisations. A typical setup includes a billing-account-level budget for total spend visibility, per-project budgets for team accountability, and per-service budgets for high-cost services like BigQuery or Compute Engine.
Should I set a billing budget before deploying my first GCP resource?
Yes. Creating a budget before you deploy anything is one of the most important habits for beginners. A forgotten VM, an unoptimised BigQuery query, or an open Cloud SQL instance can generate real charges within hours. Set a budget with a low threshold first, then adjust the amount as you understand your actual usage patterns.