Google Cloud (GCP)

6 Mins Read

Autoscaling in GCP

Voiced by Amazon Polly

Introduction to Autoscaling?

The autoscaling features of managed instance groups (MIGs) enable you to add or remove virtual machine (VM) instances from an MIG in response to changes in load. This blog on Autoscaling in GCP helps you implement apps to function more smoothly and cheaper when fewer resources are needed. Based on the parameters you set and the measured load, the autoscale automatically scales according to the autoscaling policy you designate.


  1. Only managed instance groups (MIGs) can be used with Autoscaling. Support is not provided for unmanaged instance groups.
  2. When Autoscaling is enabled, instances with specific names cannot be created. However, after virtual machines (VMs) with certain names are built, you can activate Autoscaling.
  3. Except for Cloud Monitoring metrics, where an autoscaling can handle up to five signals based on Monitoring metrics, an autoscaling can only manage one signal per metric type when making scaling decisions. After determining the optimal number of virtual machines for each signal, the autoscaling scales according to the signal that produces the greatest number of virtual machines overall.
  4. Autohealing and Autoscaling operate separately. The managed instance group tries to recreate the instance if you have auto healing enabled for your group and an instance fails the health check. There may be a smaller number of instances operating in the group than the minimum required for the group when an instance is being recreated by the managed instance group.

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More


Managed instance groups
One characteristic of managed instance groups (MIGs) is Autoscaling. A group of virtual machine (VM) instances created from a common instance template is known as a managed instance group. Based on the autoscaling policy of the group, an autoscaler adds or removes instances from a managed instance group. While Compute Engine offers both managed and unmanaged instance groups, autoscalers are compatible with only managed instance groups.


Autoscaling in GCP policy
You designate one or more signals that the Autoscaling will use to scale the group when you define an autoscaling policy for your group. Autoscaling determines the optimal number of virtual machines (VMs) for every signal you specify in a policy and sets the recommended size of your group to the highest number when you set multiple signals.


Target utilization metrics
One or more of the following metrics, which indicate the instance group’s load, can be used to determine the Autoscaling in GCP:

  1. Average CPU utilization
  2. HTTP load balancing serving capacity
  3. Cloud Monitoring metrics

Based on the chosen utilization metric, the autoscaler continually collects usage data. It then compares actual utilization to your target utilization and uses the results to decide whether the group should add or remove instances (scale out) or both.

The setup fee for an autoscaling policy is non-existent. Because Autoscaler dynamically adds and removes virtual machine instances, you only pay for the resources that your MIG actually uses. By setting the minimum and maximum number of instances in the autoscaling policy, you can manage resource costs.

Automatic repair and auto-healing with Autoscaling in GCP
By proactively keeping your instances available, managed instance groups ensure high application availability. A MIG recreates failed instances to fix them automatically.

It could be a good idea to fix applications that crash, freeze, or run out of memory. By using a health-checking signal to identify application-specific problems like freezing, crashing, or overloading, application-based autohealing increases the availability of applications. The group instantly recreates the virtual machine instance if a health check finds that an application has failed on that machine.

Unmanaged instance groups with Autoscaling in GCP
You have the freedom to add and remove diverse instances from unmanaged instance groups at will. Unmanaged instance groups are not suitable for deploying highly available and scalable workloads because they lack the ability to use instance templates, Autoscaling, auto-healing, rolling update support, and multi-zone support. If you need to manage the instances yourself or apply load balancing to groups of heterogeneous instances, use unmanaged instance groups.

Steps to perform Autoscaling

Task 1: Create Instance Template

  1. Login to the console and first create an instance template, which we will require while creating the instance group and load balancer.
  2. Go to the menu and search for Compute engine. Under the compute engine, select instance template. Then click on Create Instance Template.

  1. Give the template name, then select as below
  • Location – Global
  • Machine Configuration – N1
  • Firewall – Allow HTTP traffic and Allow HTTPS traffic

Keep the rest as it is.

And then click on create



Task 2: Create an Instance Group

  1. Go to the menu and search for Compute engine. Under the compute engine, select instance group.


  1. Click on Create instance group.


  1. Please fill in the below details
  • Name: Instancegroup
  • Instance template – Select the instance template that we have created.
  • Location – Single Zone and select the region
  • Autoscaling – On: add and remove instances to the group
  • Maximum number of instances – 1
  • Minimum number of instances – 3

We can keep the rest as it is.

  1. Now go to self-healing and create the health check as below –


Task 3: Creating a Health Check

  1. Once you click on Create a health check, just give the name of the health check and keep the rest as it is. Click on save. This will create a health check. Select the same from the health check dropdown.

  1. Once you select the health check, click on the create button for instance group.

  1. You will get the below page. We must wait for some for the instance group to get created.

  1. Once this instance group is created, one virtual machine will be created automatically under the compute engine. To check that, go to the menu, click on Compute Engine, and select Virtual Machine.

  1. Now, to check whether the Autoscaling works or not, we have to SSH the instance and increase the CPU utilization on it.
  2. SSH into the machine and Run the command – cat /dev/zero >> /dev/null && then press enter

  1. Once we run the above command, the CPU utilization will increase. To check that, just type the command as top and press enter.

  1. After some time, if you check, the number of instances will be increased to 3 automatically as Autoscaling will increase the instances for distributing the traffic. Please find the screenshot below. There was only one instance running, and now there are three instances running.

  1. Now, let’s release the traffic from the instance, and then Autoscaling will automatically decrease the instances. To release the traffic, just press k and press enter two times. This will decrease the traffic from the instance, and now Autoscaling will decrease the instances, and we will have only one instance running.


Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, Microsoft Gold Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

WRITTEN BY Babajan Tamboli



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!