Jump to Content

Five ways to save on Compute Engine costs

May 30, 2024
Maciej Strzelczyk

Developer Programs Engineer, Google Cloud Platform

A penny saved is a penny earned

Try Gemini 1.5 models

Google's most advanced multimodal models in Vertex AI

Try it

Compute Engine offers a variety of ways to reduce costs, from optimizing your infrastructure to taking advantage of discounts. In this two-part blog post, I'll share some practical tips that can help you save money on Compute Engine. Whether you work for a small business just getting started with the cloud or a large enterprise looking to optimize its spending, there's something for everyone in this guide.

1. Inspect your current spending structure

Before you start on a journey to optimize your Compute Engine budget, it would be nice to have a map — an understanding of your current situation and spending structure so you can make informed decisions about what to do next. The Google Cloud console’s billing panel is just that map. It tells you exactly what you’re spending money on, with every expense tracked down to a single SKU. You can use it to see the big picture of your organization’s finances as well as analyze costs of a specific product usage for a particular project.

Looking more closely at your spending can help you identify resources that you no longer need, but are still paying for. After all, there’s no better way to save money, than just not spending it.

2. Check out automated recommendations

Have you noticed the lightbulbs next to some of your machines on the page that lists your virtual machines? These are automatic recommendations from Google Cloud on actions you can consider to save money. These helpful tips are coming from Recommendation Hub, a new tool that aims to help you manage your project in following categories: Cost, Security, Performance, Reliability, Management, and Sustainability. The recommendations system has some insight into your fleet structure and can suggest actions that you can consider. The goal here is to help you reduce cost, without impacting fleet performance.


The system can suggest actions like changing the machine type (i.e. from n1 to e2), scaling down the machine based on its utilization, etc. Once you click on a recommendation, you receive a summary of the suggested change, with the estimated cost saving.  You can choose if you want to apply the change. Remember that changes to compute require the instance to be restarted.


3. Verify your disk types

Every virtual machine in your fleet has to have at least one persistent disk attached to it. Disks in Google Cloud come in different types, offering various performance and features. The available types are:

  • Hyperdisk - Designed for the most demanding mission-critical applications, Hyperdisk offers a scalable, high-performance storage service with a comprehensive suite of data persistence and management capabilities.

  • Hyperdisk Storage Pools - Pre-purchased collection of capacity, throughput, and IOPS which you can then provision to your applications as needed.

  • Persistent Disk - The default storage solution for your virtual machines. It can be zonal or regional. Comes in four variants:

    • Standard - Equivalent of an HDD disk in  your desktop computer. Provides the cheapest storage in exchange for slower I/O speeds.

    • SSD - A speed-oriented solution, providing great I/O performance, but at a greater cost per GB.

    • Balanced - The middle ground between “Standard” and “SSD;” the default solution for new compute instances.

    • Extreme - For the most demanding workloads. Allows you to control not only the size of the disk, but also its IOPS.

  • Local SSD - An SSD that’s physically connected to the host your virtual machine is running on. Extremely fast, but not persistent.

Let’s focus on the Persistent Disk storage family, as this is the most popular storage solution. When creating a new virtual machine, the default disk type used is the Balanced disk, which as the name implies, provides a good balance between performance and cost. While this is suitable for many scenarios, it may not be the best option for all applications. For example, stateless applications that are part of auto-scaling deployments and store all the relevant information in an external cache or database do not require fast I/O to disk. These applications are great candidates for changing their disk type to Standard, which can be up to three times cheaper per GB than the Balanced disk (depending on the region).

You can grab a list of disks used in your project with: gcloud compute disks list --format="table(name, type, zone, sizeGb, users)"

To change the disk type, you will need to clone it and modify the virtual machines using it, to begin using the new disk. 

4. Release empty space of your disks

Continuing with storage, your disk type is not the sole factor affecting costs. Disk utilization can also play a big role in your budget. When you have a 100 GB persistent disk in your project, you pay for the 100 GBs, no matter whether you use 20%, 70% or 100% of this space. Even if your application doesn’t use Persistent Disks for data storage, you still might want to pay close attention to your boot disks. Consider if your stateless application truly requires a disk with multiple gigabytes of available space, then consider trimming those disks to fit your actual usage. Humans like round numbers and may often create 20 GB disks, when they need only 12 GBs. Be more like a machine, save money.

5. Commit to using Committed Use Discounts *(CUDs)

This advice applies to many more products than just Compute Engine. If you know that you’ll be using a certain number of virtual machines for at least a year (or three years), you can get a solid discount! Using a variety of (CUDs), you can acquire much lower prices for vCPUs, memory, GPUs, local SSDs, sole-tenant nodes, and software licenses. With Flex CUDs, you don’t even need to restrict your vCPU and memory commitments to a single project, region, or machine series.

Committed use discounts are available for many Google Cloud products. If you’re happy with Google Cloud and don’t plan on leaving anytime soon, strongly consider using CUDs wherever possible to achieve powerful savings. In the case of compute, you can purchase CUDs directly from the Google Cloud console.

Good luck!

That’s it for this batch of advice. Stay tuned for our next post, where we’ll share even more tips on how to save money on compute.

Posted in