2.6 Step 5: Set Budgets and Alerts

Diagram showing an overview of the six steps. Step 5 is highlighted.

Cloud computing can save a great deal of money, time and effort by providing compute on an as-needed basis. However, care must be taken that users do not accidentally request excessive resources, or leave resources running when not needed.

Unfortunately, there are two issues that make direct cost control difficult:

  • The Google Cloud billing interface does not provide a way to automatically cancel computations when a spending threshold is reached
  • Compute costs are reported with a delay (~1 day)

As a PI or lab manager, there are some steps you can take to help monitor and limit spending:

  • Be careful with members and permissions in your Billing Projects and Workspaces on Terra (see Adding Users and Workspaces for recommended setup)
  • Most importantly, monitor your spending so you can shut down unnecessary expensive activities before they have time to accumulate.
  • Terra provides extensive documentation and examples regarding cost management while working in the cloud

We highly recommended you set budgets and alerts to notify you if spending starts to exceed expectations. This will make it easier to notice and shut down any accidental overspending. A good starting point is to set a monthly budget, and then set alerts at 50 percent and 90 percent of expected spend. You can add additional alerts if you desire.

You can set a single Budget for your entire lab, set up individual budgets for each Billing Project, or even set budgets for certain subsets of your Billing Projects. This will depend on the size of your lab and how closely you want to monitor spending. More granular budgets make it quicker to notice and track down overspending from a particular project but mean you will get more emails every month. When setting budgets with broader scope, you can always find out which particular Billing Project is spending the money by checking in the GCP Billing interface. NOTE: that there may be some restrictions on the budgets and alerts you can set while you’re using GCP’s free credits. At the time of writing (Feb 2021) you are not able to set budgets for individual projects while you are using the GCP free credits, but can still set an overall budget. Any restrictions should be lifted when you upgrade to a paid account.

2.6.1 Set Alerts

  1. Log in to the Google Cloud Platform console using the Google ID associated with your Google Cloud projects.

  2. Open the dropdown menu on the top left and click on Billing.

    Screenshot of the Google Cloud Console drop-down menu, with "Billing" highlighted.

  3. You may be automatically directed to view a specific Billing Account. If you see information about a single account (and it’s not the one you’re interested in), you can get back to the list of all your Billing Accounts by clicking “Manage Billing Accounts” from the drop-down menu.

    Screenshot of an individual Google Cloud Billing Account with the drop-down menu item "Manage Billing Accounts" highlighted.

  4. Click on the name of the Billing Account you want to set alerts for.

    Screenshot of Google Cloud Billing Accounts Overview. A Billing Account name is highlighted.

  5. In the left-hand menu, click “Budgets & alerts”.

    Screenshot of an individual Google Cloud Billing Account with the left-hand menu item "Budgets & alerts" highlighted.

  6. Click the “Create Budget” tab.

    Screenshot of the budgets and alerts page for a Google Cloud Billing Account. The "Create Budget" button highlighted.

  7. Enter a name for your budget, and then choose which projects you want to monitor. Then click “Next”.

    Screenshot of the form for setting budget scope for a Google Cloud Billing Account. Three things are highlighted:  1) the box for entering a "Name" for the budget, 2) the dropdown menu labeled "Projects" for selecting which Billing Projects are part of the budget, and 3) the "Next" button.

  8. For Budget Type, select “Specified amount”. Enter the total budget amount for the month (you will set alerts at different thresholds in the next step). Click “Next” (do not click “Finish”).

    Screenshot of the form for setting budget amount for a Google Cloud Billing Account.  The drop-down menu labeled "Budget type" is highlighted and "Specified amount" is selected.  Also highlighted are the text box labeled "Target amount" and the "Next" button.

  9. Enter the threshold amounts where you want to receive an alert. We recommend starting with 50% and 90%. You can set other alerts if you prefer.

    Screenshot of the form for setting budget actions for a Google Cloud Billing Account.  The boxes for entering "Percent of budget" or "Amount" are highlighted.  The drop-down menu labeled "Trigger on" is highlighted and "Actual" is selected.

  10. Check the box for “Email alerts to billing admins and users”, then click “Finish”. Now you (as the owner and admin), along with anyone you added with admin or user privileges (e.g. lab managers) will receive alerts when your lab members reach the specified spending thresholds. These emails will be sent to the Gmail accounts associated with the Billing Account.

    Screenshot of the form for setting budget alerts for a Google Cloud Billing Account.  The checkbox labeled "Email alerts to billing admins and users" is highligheted and checked.  The "Finish" button is highlighted.

  11. You can edit your budgets at any time by going to Billing > Budgets & alerts, and clicking on the name of the budget you want to edit.

    Screenshot of the Google Cloud Billing Account Budgets and alerts overview.  Four items are highlighted illustrating how to view and edit an existing budget: 1) The top-left "hamburger" button for extending the drop-down menu, 2) the drop-down menu item "Billing", 3) the submenu item "Budgets & alerts, 4) the name of a budget.

2.6.2 View spend

You can always check your current spend through the Google Billing console, but remember

  • There is a reporting delay (~1 day), so you cannot immediately see what an analysis cost
  • Costs are reported at the level of Workspaces, so if there are multiple people using a Workspace, you will not be able to determine which of them was responsible for the charges.

The Google Billing console displays information by Billing Account. To view spending:

  1. Log in to the Google Cloud Platform console using the Google ID associated with your Google Cloud projects.

  2. Open the dropdown menu on the top left and click on Billing.

    Screenshot of the Google Cloud Console drop-down menu, with "Billing" highlighted.

  3. You may be automatically directed to view a specific Billing Account. If you see information about a single account (and it’s not the one you’re interested in), you can get back to the list of all your Billing Accounts by clicking “Manage Billing Accounts” from the drop-down menu.

    Screenshot of an individual Google Cloud Billing Account with the drop-down menu item "Manage Billing Accounts" highlighted.

  4. Click on the name of the Billing Account for the project you want to view.

    Screenshot of Google Cloud Billing Accounts Overview. A Billing Account name is highlighted.

  5. Look at the top of the Overview tab to see your month-to-date spending.

    Screenshot of a Google Cloud Billing Account Overview.

  6. Scroll further down the Overview tab to show your top projects.

    Screenshot of a Google Cloud Billing Account top projects.

  7. Click on the Reports tab to see more detailed information about each of your projects. This is probably the most useful tab for exploring costs of individual projects over time.

    Screenshot of a Google Cloud Billing Account Reports tab.

  8. Click on the Cost table tab to obtain a convenient table of spending per project.

    Screenshot of a Google Cloud Billing Account Cost table tab.

2.6.3 Export Cost Data to BigQuery

Coming soon – instructions on how to export your cost data so you can better analyze and control your expenses.