Google Cloud customers can plan, monitor, and control costs using budgets and budget alerts. Monitoring and controlling costs effectively is important, especially as you scale your business in the cloud. When you're using Google Cloud, our budgets and alerts features are a powerful part of your cost monitoring toolkit, letting you set your target spending and notify key stakeholders if you're getting off track.
About budgets
Cloud Billing offers two types of budgets:
Alerts-only budgets – Available for all services. Alerts-only budgets let you track your actual spend relative to your planned budget, then generate alerts when your spend exceeds any threshold amounts you've set. Calculating actual spend typically takes up to 24 hours.
After you set your budget scope (filters) and a budget amount, you set budget alert threshold rules that are used to trigger email notifications. Budget alert emails help you stay informed about how your spend is tracking against your alerts-only budget. You can also use alerts-only budgets to automate cost control responses using Pub/Sub topics for programmatic notifications (for example, to forward your budget messages to other mediums such as Slack, or to automate cost management tasks).
Spend-cap budgets – Available for limited services. Spend-cap budgets let you set a maximum amount to spend on an eligible service in a specified project. When your gross, estimated spend exceeds your budget amount, the spend cap is enforced, which pauses new usage of the service in the specified project until the spend cap is lifted. Since spend caps are enforced using estimated, gross costs, spend caps are triggered much faster than alerts-only budgets, which use actual spend calculations.
In the Google Cloud console, you can manage one Google Cloud budget at a time. Using the Cloud Billing Budget API, you can view, create, and manage budgets programmatically at scale, up to 50,000 budgets for each Cloud Billing account. Learn how to check your budget quota.
Examples for using the Cloud Billing Budget API include the following:
- Create a separate alerts-only budget for each of your Google Cloud projects so you know which areas of your Google Cloud environment are spending more than expected.
- Create a spend-cap budget for each of your Google Cloud projects to prevent overspending on a specific service.
- Bulk update all of your budgets after quarterly financial planning.
- Integrate with your company's deployment manager to add the creation of budgets to your cloud provisioning workflow.
Prerequisites
Read through the prerequisites before you start coding your first Cloud Billing budget application.
Setup
Complete these setup steps to get ready to start using the Cloud Billing Budget API.
Using the API
To get up and running with the Cloud Billing Budget API, refer to the instructions in the user guide for the type of budget you want to manage:
- Using the Cloud Billing Budget API for alerts-only budgets.
- Using the Cloud Billing Budget API for spend cap budgets.
Reference
For a full list of methods, see the reference documentation.