Insights

How to Control Your Google Cloud Platform Spend

Written by Luka Cempre | Mar 1, 2022 7:00:00 AM

As a premier Google Cloud Platform partner, we often help clients navigate the billing portion of the platform. This means helping them understand the reports, set up alerts and create hard limits.

Here is a quick overview of what can be done to have a good grip of your spend.

How to Read the Billing Report

Make sure to keep an eye on your billing report regularly and use it to identify any increase or decrease in spending, usage of new services, or SKUs within those services. Understanding your usage will also help you determine potential opportunities, such as flat-rate pricing, pre-paying at discounted rates, etc.

You can access your billing report via https://console.cloud.google.com/billing.

A big blue column on 2/14 indicating above normal spend on BigQuery Analysis.

Google Cloud Projects are the highest level entities connected to your billing account. If cost is generated, a project needs to be connected to a billing account. However, a single billing account can be used with multiple projects.

Service is one of over a hundred products available within the Google Cloud Platform (GCP). Services include Compute Engine, BigQuery, Cloud SQL, etc. Since each product can be used in different ways - Google Cloud Storage, for example, can be used for different types of storage, operations and egress - billing is calculated on a more granular level.

SKU is the resource used by your service. For example, Analysis in BigQuery, RAM Time in Cloud Dataflow, Frontend Instances in App Engine and many others. It is the most granular description of your "itemized bill" and its usage translates directly into dollars. For example, a TiB of queried data (Analysis in BQ) will cost you $5.

As you can see from the screenshot above, you can filter or group reports by project, service, and SKUs You will also be able to adjust your date range and include/exclude discounts and promotions.

For more info, check out Google's official documentation on reading the invoice. To calculate potential spend, check out GCP's pricing calculator.

Alerts

Your billing account allows you to set up alerts based on your month (quarter, year) to date as well as custom date range spend. Alerts can be scoped to include the whole billing account, individual projects or individual services. You are also able to select between including or excluding credits from discounts and promotions.

Alerts can be set as a fixed amount (for example monthly budget) or a dynamic value based on the spending from the previous period.

There are two actions that will trigger an alert to send out an email (pub/sub messages are also available):
- After a certain percent of the budget (set in step 1) has been reached
- When a certain percent of the budget is forecasted to be reached (based on the historical spend, its growth, etc.).

Remember that budget alerts are of informative nature only and cannot prevent your services from running. There is also a considerable delay between the time the charge was incurred and the alert being sent out. It may take hours before a service charge shows up in billing. To prevent unexpected charges ahead of time, make sure to set up hard limits on services that you will utilize.

Hard Limits

Hard limits in GCP are limits set for individual services and will stop a process from executing if doing so would push their usage above the limit.

First, make sure that your projects only allow APIs for services that you plan to use. Note that some services are enabled by default. You can see all of the enabled APIs for the project in the APIs & Services area. Before using any new service in GCP, you will be prompted to Enable the API for it.

Setting a Hard Limit

Working with big-data focused clients, the most common limitation that we suggest is for BigQuery query usage. We have seen mistakes (often programmatic) cause charges orders of magnitude above expected. In BigQuery specifically, mistakes include inefficient querying of all columns (SELECT *) when that is not required, not utilizing sharding (using date attribute instead of _table_suffix), partitioning, or clustering, poorly splitting a problem into multiple queries...

To protect your billing account, it makes a lot of sense to set up a query usage daily limit. This can be done in the Quotas (under IAM & Admin) page. To set a limit, check the box in front of the quota row and click on the "EDIT QUOTAS" button at the top.

You will then be able to limit daily query usage to the desired size. Since BigQuery usage is charged at $5 per TiB, a limit of 10TiB would limit BQ processing cost to $50 per day.

We recommend that you take some time to get familiar with billing reports and set up alerts and limits. This will prevent unexpected charges, allow you to understand your bill and make your Cloud experience far more relaxed. As always, feel free to contact our team with any questions.