Things you can do to avoid high bills from Google Cloud

Table of Contents

In this post I would like to focus on Cloud Billing and possible ways of avoiding unpleasant surprise at the end of the month related to bill from Google Cloud. If your free trial just ended, you want to start your adventure with GCP or simply try new things this might be the right place for you. For those who already have some services deployed and GCP and are looking for advices how to cut/optimize the costs I will write separate post.

Don't be that guy.

Sign in for free trial

At the moment of creating this post Google offers 300 USD for new users. That’s great offer to get familiar with the platform and check what it has to offer. If you haven’t used it already this might be the good start for you, but remember to get familiar with other topics here since these 300 bucks might evaporate fast.

  1. Yes, debt/credit card is required to activate the account.
  2. No, you won’t be billed till you upgrade to paid account. You have to manually enable it.
  3. You will get 300$ for 90 days.
  4. After 90 days your resources will be disabled and marked for deletion (no costs). So if you enable free trial and forget about it no costs on your side.

Here you can sign in for free trial.

Free trainings

Most of the cloud providers share online courses and trainings. From time to time some trainings are provided for free. This is not different for Google Cloud. This provides an influx of new developers to cloud providers and as a result increase the amount of potential customers in the future. I’ve collected the list of places where you can find for free trainings.

  1. Grow your career with Google Cloud - free 30 days access to Qwiklabs with trainings and some prises.
  2. Google Cloud training - it’s worth to sign in for newsletter. From time to time you will receive some free trainings.
  3. Google Cloud Events - events with experts where you can learn and listen about GCP

Free tier

Whenever you create a new service or enabling new API it’s worth to check if some of them is on the list of “free” services. Before you jump in and create you free VMs read the list with commonly made mistakes:

  1. Put attention on region and zone where free tier is available. At this moment Compute Engine is available for free only in Oregon: us-west1, Iowa: us-central1 and South Carolina: us-east1.
  2. You can store files in Cloud Storage, but it should have location type set to regional (the default value is Multi-region)
  3. Cloud Functions store code in Cloud Storage and by default create Multi-region buckets (see point 2).

Default buckets created by Cloud Function

These are the topics that I found quite popular on Reddit or StackOverflow. Of course there are more such cases, so always check what actually will be used by the service you want to create.

Here you can check what’s available in free tier with usage limits Free Tier.

Use price calculator

If you not sure if you will have to pay or how much you will have to pay for services it’s good to check the approximate cost. GCP Price calculator allows you to pick the required services and provide estimated usage: execution time, required storage, egress network etc. So before you create anything you can check how much it will cost. Please remember that calculator provides estimates ony and your costs may wary.

Default buckets created by Cloud Function

Link to Price calculator.

Disable services you don’t use

One of the best saving methods is to disable what you don’t use. Let me give you an example. Imagine the situation you’ve created new Cloud SQL instances for testing purposes. You imported some data to it, wrote a client that connects to instance etc. After few hours of intensive testing/developing you want to take a break for few hours. Now recall one of the biggest advantage of Cloud - “Pay only for what you use”. During your break Cloud SQL instance is still working - using CPU and memory to keep database working and as you may guess you are being billed for that. So should you delete the database before each break and create new instance whenever you start work? The answer is no, it’s enough to just stop the instance - you will still be charged for storage, but the cost will be significantly less.

Disable Cloud SQL instance example

The same rule applies to other services as well. If you don’t need something at the moment disable it.

Set up budget alerts

This one is useful if you have some budget you don’t want to cross or would like take as much as possible from free tier. GCP provides useful service which notifies you whenever cost of the services exceeds some threshold. For example, you are planning to play with different services witch are not available in free tier, and you know that you might be charged for them, but at the same time you don’t want to spend a lot - let’s say X$. So you set up the billing alert to inform you when the total cost will be 10% of X, 50% of X etc.

One note: this won’t disable the billing, it will just inform you whenever the specific spending threshold will be crossed.

Direct link how to set up budget alerts

Panic mode / longer break from GCP - disable billing

If you just received a bill from GCP, want to take a longer break from GCP or any other reason there is a simple way to stop being charged for services. Just keep in mind that you will still have to pay for what you’ve already used.

Disabling billing on a project will cause all Google Cloud services in the project to terminate, including free-tier services.
From: https://cloud.google.com/billing/docs/how-to/notify (10.02.2022)

Simply disable the billing on the project. Direct link to billing page

Disable project billing

Summary

So this is general advice how to avoid paying high bill. If you try to set up something choose the smallest possible resources. Want to test compute instance (VM)? Create f1-micro instance with shared resources in free tier location. Want to create Cloud SQL instances for testing? Use the smallest instance on slow SDD and remove it after the tests or better run container on your local machine with SQL Database.

The point is: start from the smallest possible setup. If you hit the point when resources will limit your services, then it will be the right time to scale.

Hope you found this post helpful, and you will avoid high bills from GCP from now. Good luck and have fun!

Read more

  1. Cloud Billing documentation
  2. Pricing Calculator - see the cost estimations of services you plan to create