Set cost alerts before the surprise bill

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:

bash
cloud billing budget set --amount 400 --currency USD

The 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.

cloud.alerts.yml
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:

cloud.config.ts
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.

Share:

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.

Newsletter

Engineering notes, once a month

Release highlights, deep dives from the platform team, and guides you can use the same day. No spam.

gats-fo-lex

Unsubscribe anytime. Read our Privacy Policy.

Free tier · No credit card

Push code today. Be live before your coffee cools.

Connect a repository, pick a region, and get a production URL with HTTPS, logs, and autoscaling already switched on.

$ git push origin main

  1. Build34 s
  2. Deploy12 s
  3. Health checks3 s

your-app.example.com

Buy NowTheme Details