If you haven't already, set up authentication.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI.
After installation,
initialize the Google Cloud CLI by running the following command:
You can autoscale based on the average CPU utilization of a managed
instance group (MIG). Using this policy tells the autoscaler to collect the CPU
utilization of the instances in the group and determine whether it needs
to scale. You set the target CPU utilization the autoscaler should maintain and
the autoscaler works to maintain that level.
The autoscaler treats the target CPU utilization level as a fraction of the
average use of all vCPUs over time in the instance group. If the average
utilization of your total vCPUs exceeds the target utilization, the autoscaler
adds more VM instances. If the average utilization of your total vCPUs is
less than the target utilization, the autoscaler removes instances. For example,
setting a 0.75 target utilization tells the autoscaler to maintain an average
utilization of 75% among all vCPUs in the instance group.
You can also scale based on forecasted CPU utilization. For more information,
and to see if this is suitable for your workload, see
Scaling based on predictions.
Enable autoscaling based on CPU utilization
To enable autoscaling based on CPU utilization, use one of the following options.
If you want to configure a stabilization period to control the pace of scaling
in, then you must use either Google Cloud CLI or REST.
Permissions required for this task
To perform this task, you must have the following
permissions:
During periods of heavy CPU utilization, if utilization is close to
100%, the autoscaler estimates that the group might already be heavily
overloaded. In these cases, the autoscaler increases the number of virtual
machines by 50% at most.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-11 UTC."],[],[]]