We mentioned autoscaling earlier and this deserves a full section to itself. Autoscaling is a fundamental principle of cloud computing. It allows infrastructures to be elastic and will increase and decrease based on demand. As a reminder, we can only use autoscaling with managed instance groups. This is because only managed instance groups will use a dedicated template, which, in turn, can create a pool of homogeneous VM instances.
Once autoscaling is enabled in our instance group, it also enables many settings under an Autoscaling policy. These policies can be based on CPU usage, HTTP load balancing usage, or Stackdriver metrics. We should also note here that it is possible to autoscale based on custom metrics so we are not reliant only on out-of-the-box metrics.
The following example is based on CPU usage, which is the simplest form of autoscaling. The autoscaler...