Correct, budgets on Google Cloud only alert. There is no built-in hard cap, and billing data lags a few hours, so even an automated stop happens after the fact.
If you want an automatic kill switch, the documented approach is:
- Connect the budget to a Pub/Sub topic (Budgets > your budget > "Connect a Pub/Sub topic").
- Deploy a Cloud Function subscribed to that topic that, when
costAmount > budgetAmount, calls the Cloud Billing API to disable billing on the project.
Understand what that means: detaching billing shuts down everything that needs Blaze (functions, storage beyond free quota, etc.). Your app goes down. That's the trade-off you're choosing.
Cheaper first steps: fix read patterns (listen once, paginate, cache), and set App Check so random scripts can't hammer your DB.