Scaling Virtual Machines on Google Cloud Platform

Robert Thas John
2 min readJul 17, 2018

--

Availability is always top of mind when providing a service over the Internet. It doesn’t matter whether you serve static pages or dynamic ones, or whether your service is meant for businesses or consumers. Scale is what matters.

Scale is also what the cloud is about. The ability to go from serving 1 client in one minute, to serving 1000 the next.

I am going to assume a certain knowledge of creating virtual machines on the Google Cloud Platform (CGP henceforth).

One thing I have always found interesting, is the ability to have an operation that you can configure to scale based on certain metrics, and at the same time specify some bounds. For example, you might have a minimum of two instances of your virtual machine running, and configure a maximum of eight. You could then set them to come on when a certain load level is attained, say a certain processor utilization.

To accomplish this, you will need two things: an instance group, and a load balancer.

Your instance group can be configured for one region or multiple regions. You will also need to specify a zone and a group type. The group type is either Managed or Unmanaged. Unless you know what you are doing, what you need is a managed instance group. This type of group contains identical instances created from a template. This comes with automatic scaling, healing, and rolling updates.

You will need to specify your instance template, and whether or not you want autoscaling. If you want it, you will need to specify the condition on which autoscaling occurs.

Once you are done creating your instance group, you may proceed to create your load balancer. For this, you will need to specify what protocols to enable on the frontend, what ports to open, and what certificates, if any, you would like to utilize.

For the backend, you will need to link to your instance group.

When you are done, you will have an IP address to publish and use with your service, and your clients won’t know what’s up besides the fact that your service just keeps rocking!

--

--

Robert Thas John
Robert Thas John

No responses yet