
Usage-based pricing is fair, but only if you can see the usage. A runaway job, a missing cache, or a traffic spike can double a bill in a weekend. This guide sets up three layers of protection in about fifteen minutes.
Set a monthly budget
A budget is the amount you expect to spend in a month. It does not stop anything; it gives every alert a reference point. Set it in Billing → Budget, or from the CLI:
cloud billing budget set --amount 400 --currency USDThe dashboard then shows your forecast for the month next to the budget, based on your usage so far.
Alert on the forecast, not the total
An alert on the total spend fires when the money is already gone. An alert on the forecast fires as soon as the trend changes, often days earlier.
alerts:
- name: forecast-over-budget
when: forecast > budget * 1.1
notify: ["#ops", "billing@example.com"]
- name: daily-spike
when: spend_today > spend_7d_avg * 2
notify: ["#ops"]Apply the file with cloud alerts apply. Alerts can notify a chat channel, an email address, or a webhook.
Find the service behind a spike
When an alert fires, open Billing → Usage and group by service. Each service shows its compute, bandwidth, and storage for the day, so a spike usually points to one line. From there, the service metrics show whether it came from more traffic or from more work per request.
Cap what can run away
Some resources can grow without limit: autoscaling services, background workers, and build minutes. Give them a ceiling:
export default defineConfig({
service: "image-worker",
instances: { min: 0, max: 20 },
spendCap: { monthly: 150, action: "scale-to-min" },
});When the cap is reached, the service scales to its minimum instead of growing further, and the alert tells you why. Raise the cap from the dashboard if the growth was expected.
With a budget, forecast alerts, and caps in place, the invoice becomes a confirmation of what you already know.
Written by
Maya Chen
Product lead, Workflows
Maya leads the workflows team and writes about background jobs, retries, and the product decisions behind each release.


