Optimizing costs for Google Cloud Platform — Part 1

Mar 24, 2017 · 2 min read

When it comes to public cloud, cost can start to matter as the business grows. With Google Cloud Platform, there are ways to optimize infrastructure architecture for monetary costs.

There are three different types of machines that you can launch in GCP

Custom Machine Types

GCP has predefined standard machine types. You get to pick n1-standard-x and can see the vCPU and memory (GiB) that it comes with. If your desired memory or CPU needs fall in-between two pre-defined machine types, choosing a custom machine is super easy. With gcloud command it is a few switches. With console it is a simple slider. You can see how to configure one via console here.

Preemptible Machine types

Cloud compute instances are ephemeral in nature. Meaning they are to be treated like cattle and not pets. Any failure in an AZ or Region-wide outage can impact your instance. If you lose an instance, you spin up a new one. This means if you are leveraging cloud with proper design, you are already setup to treat instances as ephemeral ones that can go away without much notice.

Meet preemptible instances: these can save you more than 50% on your cost. Here is the catch: they can be preempted (taken away) at a moment’s (30 seconds) notice. So you are running a job on a preemptible instance, GCP can take it away from you, giving you a 30-seconds notice to stop taking new work or finish up in-flight transactions. If you are using a BigData solution like Hadoop or are using Consul for service discovery, you can mark the instance as no longer available. Also note that the preemptible instances go away after 24 hours.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade