How to set up and use GCP budget alerts

Allie Hajian
  • Updated

Want to keep tabs on your Google Cloud Platform (GCP) spend for storage, compute and egress in Terra? This article outlines what budget alerts can (and cannot) do, what permissions are needed for these actions, and includes step-by-step instructions for setting up budget alerts for workspaces (after September 27, 2021) or Terra Billing projects (before September 27, 2021). 

What GCP budget alerts can (and cannot) do

If you are the GCP Billing account owner or administrator, you can create a GCP budget to monitor your storage, compute and egress charges on Terra. 

  1. Set budgets for the umbrella GCP Billing account or for specific workspaces (after September 27, 2021) or your Terra Billing project (before September 27, 2021).

  2. Use budgets to automate cost control responses.

  3. Set up email alerts for notification when thresholds are reached. 
    - Send to GCP Billing account owner.
    - Send to up to five additional custom email addresses.

  4. Cap billing by disabling GCP Billing accounts.

Cloud Billing Budgets alerts support configurable budget time periods, beyond monthly budgets. Is your budget tied to an external funding source, such as a grant? Now you can set the budget for the time range of the grant.

GCP budget alerts are at the Google project level (i.e. per Terra Billing project - for workspaces created before September 27, 2021 - and per workspace level - for workspaces created after September 27, 2021). You cannot get information on individual users' spend within a shared workspace with budget alerts. 

There is a delay between spend and reporting! There is a delay of up to a few days between incurring costs and receiving budget notifications. Due to this latency from the time a resource is used to the time that the activity is billed, you might incur additional costs for usage that hasn't arrived at the time that all services are stopped.

Following the steps in this capping example is not a guarantee that you will not spend more than your budget.

Recommendation: If you have a hard funds limit, set your maximum budget below your available funds to account for billing delays.

What permissions do you need to set up GCP alerts

To set budget alerts on a GCP Billing account
You must have owner or admin privileges on the GCP account

To set budget alerts on a Terra workspace
1. The workspace must be created after September 28, 2021.

2. You must have owner or admin privileges on the workspace.
3. You must have viewer permissions on the GCP Billing account.

Troubleshooting tipsIf any of the actions in the step-by-step instructions are not allowed (grayed out), you probably do not have sufficient permissions. You will need to ask the Cloud Billing account owner to update your role.

Free credits
Note that GCP is the owner of GCP free credits projects. You will not be able to set budget alerts for these until you upgrade to a paid GCP billing account.

To change/add GCP Billing account permissions
The Owner or Administrator of the Billing account should go to https://console.cloud.google.com/billing to manage the account. 
     - Choose the Billing account to add a member.
     - Select the "Manage" link at the top right.

There are additional fine-grained permissions you can set up to allow specific programmatic actions. To learn more about permissions requirements for programmatic budget alert actions (e.g. disabling billing), see Google's documentation.

How to set up a GCP budget alert for a Terra workspace

Step 1. Set budget scope

Set-project-budget-on-GCP_Step1_Screen_shot.png

1.1. Go to the main navigation menu at the top left on the GCP console (console.cloud.google.com).

1.2. Select Billing. and then the Google Cloud Billing account link (name).  

1.3. Choose Budgets and alerts in the left column. 

1.4. Click Create budget and, in the form that appears, give your budget a sensible Name

1.5. Select the project for the budget from the dropdown.

Workspace projects (created by Terra) will have the format "<Terra-billing-project>--<first-15-letters-of-workspace-name>".

To find a specific workspace Google project, open your workspace dashboard page in a separate tab, look under "Workspace Information" on the right column. 
google-project-ID.png

1.6. Select the service you want alerts for (i.e. storage, compute).

You can filter the list down by typing in the name of the service you want to track. Services Terra uses include Compute Engine (i.e. VM) and Cloud Storage (i.e. Workspace buckets)

1.7. Click Next to continue.

Step 2. Set the amount

Set-project-budget-on-GCP_Step2-Amount_Screen_shot.png

2.1. Choose the budget type from the dropdown.
       (can be last month's spend, or a specified amount)

2.2. Set the target amount (if you're using a specified amount).

2.3. Click Next to continue.

Step 3. Set alert actions

Set-project-budget-on-GCP_step3-Action_Screen_shot.png

3.1. Set the threshold rules (you can set alerts as a fraction of the total budget or a specific amount, and trigger by actual or forecasted spend).

3.2. Send alert to billing admins and users (selected by default).

3.3. Send alert to up to five additional emails.

3.4. Set up additional actions (e.g. disabling billing) by connecting a Pub/Sub topic to the budget. (for more detailed information about this functionality, see https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications)

Additional GCP documentation about budget alerts

For more details on GCP budget alerts, see https://cloud.google.com/billing/docs/how-to/budgets#permissions_required_to_manage_budgets.

To learn more about additional actions you can program alerts to execute (such as disabling billing), see https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.