gcloud beta compute instance-groups managed set-autoscaling Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta compute instance-groups managed set-autoscaling - set autoscaling parameters of a managed instance group
- SYNOPSIS
gcloud beta compute instance-groups managed set-autoscalingNAME[--autoscaling-file=PATH][--cool-down-period=COOL_DOWN_PERIOD][--cpu-utilization-predictive-method=CPU_UTILIZATION_PREDICTIVE_METHOD][--custom-metric-utilization=[metric=METRIC],[utilization-target=UTILIZATION-TARGET],[utilization-target-type=UTILIZATION-TARGET-TYPE]][--description=DESCRIPTION][--max-num-replicas=MAX_NUM_REPLICAS][--min-num-replicas=MIN_NUM_REPLICAS][--mode=MODE][--remove-stackdriver-metric=METRIC][--scale-based-on-cpu][--scale-based-on-load-balancing][--scale-in-control=[max-scaled-in-replicas=MAX-SCALED-IN-REPLICAS],[max-scaled-in-replicas-percent=MAX-SCALED-IN-REPLICAS-PERCENT],[time-window=TIME-WINDOW]][--set-schedule=SCHEDULE_NAME][--stackdriver-metric-filter=FILTER][--stackdriver-metric-single-instance-assignment=ASSIGNMENT][--stackdriver-metric-utilization-target=TARGET][--stackdriver-metric-utilization-target-type=TARGET_TYPE][--target-cpu-utilization=TARGET_CPU_UTILIZATION][--target-load-balancing-utilization=TARGET_LOAD_BALANCING_UTILIZATION][--update-stackdriver-metric=METRIC][--region=REGION|--zone=ZONE][--schedule-cron=CRON_EXPRESSION--schedule-description=DESCRIPTION--schedule-duration-sec=DURATION--schedule-min-required-replicas=MIN_REQUIRED_REPLICAS--schedule-time-zone=TIME_ZONE][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)gcloud beta compute instance-groups managedset-autoscalingsets autoscaling parameters of specified managed instancegroup.Autoscalers can use one or more autoscaling signals. Information on usingmultiple autoscaling signals can be found here:https://cloud.google.com/compute/docs/autoscaler/multiple-signals
- POSITIONAL ARGUMENTS
NAME- Name of the managed instance group to operate on.
- FLAGS
--autoscaling-file=PATH- Path of the file from which autoscaling configuration will be loaded. This flagallows you to atomically setup complex autoscalers.
--cool-down-period=COOL_DOWN_PERIOD- The number of seconds that your application takes to initialize on a VMinstance. This is referred to as theinitializationperiod. Specifying an accurate initialization period improves autoscalerdecisions. For example, when scaling out, the autoscaler ignores data from VMsthat are still initializing because those VMs might not yet represent normalusage of your application. The default initialization period is 60 seconds. See$gcloud topic datetimes forinformation on duration formats. Initialization periods might vary because ofnumerous factors. We recommend that you test how long your application may taketo initialize. To do this, create a VM and time your application's startupprocess.
--cpu-utilization-predictive-method=CPU_UTILIZATION_PREDICTIVE_METHOD- Indicates whether to use a predictive algorithm when scaling based on CPU.
CPU_UTILIZATION_PREDICTIVE_METHODmust be one of:none- (Default) No predictions are made when calculating the number of VM instances.
optimize-availability- Predictive autoscaling predicts the future values of the scaling metric andscales the group in advance to ensure that new VM instances are ready in time tocover the predicted peak.
--custom-metric-utilization=[metric=METRIC],[utilization-target=UTILIZATION-TARGET],[utilization-target-type=UTILIZATION-TARGET-TYPE]- Adds a target metric value for the Autoscaler to use.
metric- Protocol-free URL of a Google Cloud Monitoring metric.
utilization-target- Value of the metric Autoscaler aims to maintain (greater than 0.0).
utilization-target-type- How target is expressed. Valid values: DELTA_PER_MINUTE, DELTA_PER_SECOND,GAUGE.
Mutually exclusive with
--update-stackdriver-metric.
--description=DESCRIPTION- Notes about Autoscaler.
--max-num-replicas=MAX_NUM_REPLICAS- Maximum number of replicas Autoscaler can set.
--min-num-replicas=MIN_NUM_REPLICAS- Minimum number of replicas Autoscaler can set.
--mode=MODE- Set the mode of an autoscaler for a managed instance group.
You can turn off or restrict a group's autoscaler activities without affectingyour autoscaler configuration. The autoscaler configuration persists while theactivities are turned off or restricted, and the activities resume when theautoscaler is turned on again or when the restrictions are lifted.
MODEmust be one of:off- Turns off autoscaling, while keeping the new configuration.
on- Permits autoscaling to scale out and in (default for new autoscalers).
only-scale-out- Permits autoscaling to scale only out and not in.
only-up- (DEPRECATED) Permits autoscaling to scale only out and not in.
Value
only-upis deprecated. Use--mode only-scale-outinstead.
--remove-stackdriver-metric=METRIC- Stackdriver metric to remove from autoscaling configuration. If the metric isthe only input used for autoscaling the command will fail.
--scale-based-on-cpu- Autoscaler will be based on CPU utilization.
--scale-based-on-load-balancing- Use autoscaling based on load balancing utilization.
--scale-in-control=[max-scaled-in-replicas=MAX-SCALED-IN-REPLICAS],[max-scaled-in-replicas-percent=MAX-SCALED-IN-REPLICAS-PERCENT],[time-window=TIME-WINDOW]- Configuration that allows slower scale in so that even if Autoscaler recommendsan abrupt scale in of a managed instance group, it will be throttled asspecified by the parameters.
max-scaled-in-replicas- Maximum allowed number of VMs that can be deducted from the peak recommendationduring the window. Possibly all these VMs can be deleted at once so theapplication needs to be prepared to lose that many VMs in one step. Mutuallyexclusive with 'max-scaled-in-replicas-percent'.
max-scaled-in-replicas-percent- Maximum allowed percent of VMs that can be deducted from the peak recommendationduring the window. Possibly all these VMs can be deleted at once so theapplication needs to be prepared to lose that many VMs in one step. Mutuallyexclusive with 'max-scaled-in-replicas'.
time-window- How long back autoscaling should look when computing recommendations. Theautoscaler will not resize below the maximum allowed deduction subtracted fromthe peak size observed in this period. Measured in seconds.
--set-schedule=SCHEDULE_NAME- Unique name for the scaling schedule.
--stackdriver-metric-filter=FILTER- Expression for filtering samples used to autoscale, seehttps://cloud.google.com/monitoring/api/v3/filters.
--stackdriver-metric-single-instance-assignment=ASSIGNMENT- Value that indicates the amount of work that each instance is expected tohandle. Autoscaler maintains enough VMs by dividing the available work by thisvalue. Mutually exclusive with
-stackdriver-metric-utilization-target-type,-stackdriver-metric-utilization-target-type, and--custom-metric-utilization. --stackdriver-metric-utilization-target=TARGET- Value of the metric Autoscaler aims to maintain. When specifying this flag youmust also provide
--stackdriver-metric-utilization-target-type.Mutually exclusive with--stackdriver-metric-single-instance-assignmentand--custom-metric-utilization. --stackdriver-metric-utilization-target-type=TARGET_TYPE- Value of the metric Autoscaler aims to maintain. When specifying this flag youmust also provide
--stackdriver-metric-utilization-target. Mutuallyexclusive with--stackdriver-metric-single-instance-assignmentand--custom-metric-utilization.TARGET_TYPEmust be one of:delta-per-minute,delta-per-second,gauge. --target-cpu-utilization=TARGET_CPU_UTILIZATION- Autoscaler aims to maintain CPU utilization at target level (0.0 to 1.0).
--target-load-balancing-utilization=TARGET_LOAD_BALANCING_UTILIZATION- Autoscaler aims to maintain the load balancing utilization level (greater than0.0).
--update-stackdriver-metric=METRIC- Stackdriver metric to use as an input for autoscaling. When using this flag, thetarget value of the metric must also be specified by using the following flags:
--stackdriver-metric-single-instance-assignmentor--stackdriver-metric-utilization-targetand--stackdriver-metric-utilization-target-type. Mutually exclusivewith--custom-metric-utilization. - At most one of these can be specified:
--region=REGION- Region of the managed instance group to operate on. If not specified, you mightbe prompted to select a region (interactive mode only).
A list of regions can be fetched by running:
gcloudcomputeregionslistOverrides the default
compute/regionproperty value for thiscommand invocation. --zone=ZONE- Zone of the managed instance group to operate on. If not specified, you might beprompted to select a zone (interactive mode only).
A list of zones can be fetched by running:
gcloudcomputezoneslistOverrides the default
compute/zoneproperty value for this commandinvocation.
--schedule-cron=CRON_EXPRESSION- Start time of the scaling schedule in cron format.
This is when the autoscaler starts creating new VMs, if the group's current sizeis less than the minimum required instances. Set the start time to allow enoughtime for new VMs to boot and initialize. For example if your workload takes 10minutes from VM creation to start serving then set the start time 10 minutesearlier than the time you need VMs to be ready.
--schedule-description=DESCRIPTION- A verbose description of the scaling schedule.
--schedule-duration-sec=DURATION- How long should the scaling schedule be active, measured in seconds.
Minimum duration is 5 minutes. A scaling schedule is active from its start timeand for its configured duration. During this time, the autoscaler scales thegroup to have at least as many VMs as defined by the minimum required instances.After the configured duration, if there is no need to maintain capacity, theautoscaler starts removing instances after the usual stabilization period andafter scale-in controls (if configured). For more information, seeDelaysin scaling in andScale-incontrols. This ensures you don't accidentally lose capacity immediatelyafter the scaling schedule ends.
--schedule-min-required-replicas=MIN_REQUIRED_REPLICAS- How many VMs the autoscaler should provision for the duration of this scalingschedule.
Autoscaler provides at least this number of instances when the scaling scheduleis active. A managed instance group can have more VMs if there are other scalingschedules active with more required instances or if another signal (for example,scaling based on CPU) requires more instances to meet its target.
This configuration does not change autoscaling minimum and maximum instancelimits which are always in effect. Autoscaler does not create more than themaximum number of instances configured for a group.
--schedule-time-zone=TIME_ZONE- Name of the timezone that the scaling schedule's start time is in.
It should be provided as a name from the IANA tz database (for exampleEurope/Paris or UTC). It automatically adjusts for daylight savings time (DST).If no time zone is provided, UTC is used as a default.
Seehttps://en.wikipedia.org/wiki/List_of_tz_database_time_zonesfor the list of valid timezones.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudcomputeinstance-groupsmanagedset-autoscalinggcloudalphacomputeinstance-groupsmanagedset-autoscaling
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.