gcloud compute instances set-scheduling INSTANCE_NAME [--clear-min-node-cpu] [--host-error-timeout-seconds=HOST_ERROR_TIMEOUT_SECONDS] [--local-ssd-recovery-timeout=LOCAL_SSD_RECOVERY_TIMEOUT] [--maintenance-policy=MAINTENANCE_POLICY] [--min-node-cpu=MIN_NODE_CPU] [--[no-]preemptible] [--provisioning-model=PROVISIONING_MODEL] [--[no-]restart-on-failure] [--[no-]skip-guest-os-shutdown] [--zone=ZONE] [--clear-discard-local-ssds-at-termination-timestamp | --discard-local-ssds-at-termination-timestamp=DISCARD_LOCAL_SSDS_AT_TERMINATION_TIMESTAMP] [--clear-instance-termination-action | --instance-termination-action=INSTANCE_TERMINATION_ACTION] [--clear-max-run-duration | --max-run-duration=MAX_RUN_DURATION] [--clear-node-affinities | --node=NODE | --node-affinity-file=PATH_TO_FILE | --node-group=NODE_GROUP] [--clear-termination-time | --termination-time=TERMINATION_TIME] [GCLOUD_WIDE_FLAG …]
$gcloud compute instances set-scheduling is used to update
scheduling options for VM instances. You can only call this method on a VM
instance that is stopped (a VM instance in a TERMINATED state).
gcloud compute instances set-scheduling example-instance --maintenance-policy=TERMINATE --zone=us-central1-bINSTANCE_NAME--clear-min-node-cpu--host-error-timeout-seconds=HOST_ERROR_TIMEOUT_SECONDS--local-ssd-recovery-timeout=LOCAL_SSD_RECOVERY_TIMEOUT--maintenance-policy=MAINTENANCE_POLICYMAINTENANCE_POLICY must be one of:
MIGRATETERMINATE--min-node-cpu=MIN_NODE_CPU--[no-]preemptible--preemptible to enable and
--no-preemptible to disable.
--provisioning-model=PROVISIONING_MODELPROVISIONING_MODEL must be one of:
RESERVATION_BOUNDSPOTSTANDARD--[no-]restart-on-failure--restart-on-failure to enable
and --no-restart-on-failure to disable.
--[no-]skip-guest-os-shutdown--skip-guest-os-shutdown to enable and
--no-skip-guest-os-shutdown to disable.
--zone=ZONEgcloud attempts to identify the
appropriate zone by searching for resources in your currently active project. If
the zone cannot be determined, gcloud prompts you for a selection with
all available Google Cloud Platform zones.
To avoid prompting when this flag is omitted, the user can set the
property:
compute/zone
gcloud config set compute/zone ZONEA list of zones can be fetched by running:
gcloud compute zones listTo unset the property, run:
gcloud config unset compute/zoneCLOUDSDK_COMPUTE_ZONE.
Discard Local SSDs At Termination Timestamp
At most one of these can be specified:
--clear-discard-local-ssds-at-termination-timestamp--discard-local-ssds-at-termination-timestamp=DISCARD_LOCAL_SSDS_AT_TERMINATION_TIMESTAMPtrue and only allowed for VMs that have one
or more local SSDs, use --instance-termination-action=STOP, and use either
--max-run-duration or --termination-time.
This flag indicates the value that you want Compute Engine to use for the
--discard-local-ssd flag in the automatic gcloud compute instances
stop command. This flag only supports the true value,
which discards local SSD data when automatically stopping this VM during its
terminationTimestamp.
--discard-local-ssd flag, see https://cloud.google.com/compute/docs/disks/local-ssd#stop_instance.
Instance Termination Action
At most one of these can be specified:
--clear-instance-termination-action--instance-termination-action=INSTANCE_TERMINATION_ACTIONINSTANCE_TERMINATION_ACTION must be one of:
DELETESTOP--clear-max-run-duration--max-run-duration=MAX_RUN_DURATION30m for a duration of 30 minutes
or specify 1d2h3m4s for a duration of 1 day, 2 hours, 3 minutes,
and 4 seconds. Alternatively, to specify a timestamp, use --termination-time
instead.
If neither --max-run-duration nor --termination-time is specified (default), the
VM instance runs until prompted by a user action or system event. If either is
specified, the VM instance is scheduled to be automatically terminated at the
VM's termination timestamp (terminationTimestamp) using the action
specified by --instance-termination-action.
terminationTimestamp is removed whenever the VM is
stopped or suspended and redefined whenever the VM is rerun. For
--max-run-duration specifically, the terminationTimestamp is the
sum of MAX_RUN_DURATION and the time when the VM last entered the
RUNNING state, which changes whenever the VM is rerun.
Sole Tenancy.
At most one of these can be specified:
--clear-node-affinities--node=NODE--node-affinity-file=PATH_TO_FILEkeyoperatorIN: Requires
Compute Engine to seek for matched nodes. NOT_IN: Requires Compute
Engine to avoid certain nodes.
values--node-group=NODE_GROUP--clear-termination-time--termination-time=TERMINATION_TIME
If neither --termination-time nor --max-run-duration is specified (default), the
VM instance runs until prompted by a user action or system event. If either is
specified, the VM instance is scheduled to be automatically terminated at the
VM's termination timestamp (terminationTimestamp) using the action
specified by --instance-termination-action.
terminationTimestamp is removed whenever the VM is
stopped or suspended and redefined whenever the VM is rerun. For
--termination-time specifically, the terminationTimestamp remains
the same whenever the VM is rerun, but any requests to rerun the VM fail if the
specified timestamp is in the past.
--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 help for details.
gcloud alpha compute instances set-schedulinggcloud beta compute instances set-schedulinggcloud preview compute instances set-scheduling
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.