File: //snap/google-cloud-cli/394/help/man/man1/gcloud_alpha_compute_instances_set-scheduling.1
.TH "GCLOUD_ALPHA_COMPUTE_INSTANCES_SET\-SCHEDULING" 1
.SH "NAME"
.HP
gcloud alpha compute instances set\-scheduling \- set scheduling options for Compute Engine virtual machines
.SH "SYNOPSIS"
.HP
\f5gcloud alpha compute instances set\-scheduling\fR \fIINSTANCE_NAME\fR [\fB\-\-clear\-min\-node\-cpu\fR] [\fB\-\-[no\-]graceful\-shutdown\fR] [\fB\-\-graceful\-shutdown\-max\-duration\fR=\fIGRACEFUL_SHUTDOWN_MAX_DURATION\fR] [\fB\-\-host\-error\-timeout\-seconds\fR=\fIHOST_ERROR_TIMEOUT_SECONDS\fR] [\fB\-\-local\-ssd\-recovery\-timeout\fR=\fILOCAL_SSD_RECOVERY_TIMEOUT\fR] [\fB\-\-min\-node\-cpu\fR=\fIMIN_NODE_CPU\fR] [\fB\-\-[no\-]preemptible\fR] [\fB\-\-preemption\-notice\-duration\fR=\fIPREEMPTION_NOTICE_DURATION\fR] [\fB\-\-provisioning\-model\fR=\fIPROVISIONING_MODEL\fR] [\fB\-\-[no\-]restart\-on\-failure\fR] [\fB\-\-[no\-]skip\-guest\-os\-shutdown\fR] [\fB\-\-zone\fR=\fIZONE\fR] [\fB\-\-clear\-discard\-local\-ssds\-at\-termination\-timestamp\fR\ |\ \fB\-\-discard\-local\-ssds\-at\-termination\-timestamp\fR=\fIDISCARD_LOCAL_SSDS_AT_TERMINATION_TIMESTAMP\fR] [\fB\-\-clear\-instance\-termination\-action\fR\ |\ \fB\-\-instance\-termination\-action\fR=\fIINSTANCE_TERMINATION_ACTION\fR] [\fB\-\-clear\-max\-run\-duration\fR\ |\ \fB\-\-max\-run\-duration\fR=\fIMAX_RUN_DURATION\fR] [\fB\-\-clear\-node\-affinities\fR\ |\ \fB\-\-node\fR=\fINODE\fR\ |\ \fB\-\-node\-affinity\-file\fR=\fIPATH_TO_FILE\fR\ |\ \fB\-\-node\-group\fR=\fINODE_GROUP\fR] [\fB\-\-clear\-termination\-time\fR\ |\ \fB\-\-termination\-time\fR=\fITERMINATION_TIME\fR] [\fB\-\-maintenance\-policy\fR=\fIMAINTENANCE_POLICY\fR\ |\ \fB\-\-on\-host\-maintenance\fR=\fIMAINTENANCE_POLICY\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(ALPHA)\fR \fB$gcloud alpha compute instances set\-scheduling\fR 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 \f5TERMINATED\fR state).
.SH "EXAMPLES"
To set instance to be terminated during maintenance, run:
.RS 2m
$ gcloud alpha compute instances set\-scheduling example\-instance \e
\-\-maintenance\-policy=TERMINATE \-\-zone=us\-central1\-b
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIINSTANCE_NAME\fR
Name of the instance to operate on. For details on valid instance names, refer
to the criteria documented under the field 'name' at:
https://cloud.google.com/compute/docs/reference/rest/v1/instances
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-clear\-min\-node\-cpu\fR
Removes the min\-node\-cpu field from the instance. If specified, the instance
min\-node\-cpu will be cleared. The instance will not be overcommitted and
utilize the full CPU count assigned.
.TP 2m
\fB\-\-[no\-]graceful\-shutdown\fR
Enables or disables graceful shutdown for the instance. Use
\fB\-\-graceful\-shutdown\fR to enable and \fB\-\-no\-graceful\-shutdown\fR to
disable.
.TP 2m
\fB\-\-graceful\-shutdown\-max\-duration\fR=\fIGRACEFUL_SHUTDOWN_MAX_DURATION\fR
Specifies the maximum time for the graceful shutdown. After this time, the
instance is set to STOPPING even if tasks are still running. Specify the time as
the number of hours, minutes, or seconds followed by h, m, and s respectively.
For example, specify 30m for 30 minutes or 20m10s for 20 minutes and 10 seconds.
The value must be between 1 second and 1 hour.
.TP 2m
\fB\-\-host\-error\-timeout\-seconds\fR=\fIHOST_ERROR_TIMEOUT_SECONDS\fR
The timeout in seconds for host error detection. The value must be set with 30
second increments, with a range of 90 to 330 seconds. If unset, the default
behavior of the host error recovery is used.
.TP 2m
\fB\-\-local\-ssd\-recovery\-timeout\fR=\fILOCAL_SSD_RECOVERY_TIMEOUT\fR
Specifies the maximum amount of time a Local Ssd Vm should wait while recovery
of the Local Ssd state is attempted. Its value should be in between 0 and 168
hours with hour granularity and the default value being 1 hour.
.TP 2m
\fB\-\-min\-node\-cpu\fR=\fIMIN_NODE_CPU\fR
Minimum number of virtual CPUs this instance will consume when running on a
sole\-tenant node.
.TP 2m
\fB\-\-[no\-]preemptible\fR
If provided, instances will be preemptible and time\-limited. Instances might be
preempted to free up resources for standard VM instances, and will only be able
to run for a limited amount of time. Preemptible instances can not be restarted
and will not migrate. Use \fB\-\-preemptible\fR to enable and
\fB\-\-no\-preemptible\fR to disable.
.TP 2m
\fB\-\-preemption\-notice\-duration\fR=\fIPREEMPTION_NOTICE_DURATION\fR
Specifies the metadata preemption notice duration before the ACPI G2 soft off
signal is triggered for Spot VMs. e.g. 120s.
.TP 2m
\fB\-\-provisioning\-model\fR=\fIPROVISIONING_MODEL\fR
Specifies the provisioning model for your VM instances. This choice affects the
price, availability, and how long your VM instances can run.
\fIPROVISIONING_MODEL\fR must be one of:
.RS 2m
.TP 2m
\fBRESERVATION_BOUND\fR
The VM instances run for the entire duration of their associated reservation.
You can only specify this provisioning model if you want your VM instances to
consume a specific reservation with either a calendar reservation mode or a
dense deployment type.
.TP 2m
\fBSPOT\fR
Compute Engine may stop a Spot VM instance whenever it needs capacity. Because
Spot VM instances don't have a guaranteed runtime, they come at a discounted
price.
.TP 2m
\fBSTANDARD\fR
The default option. The STANDARD provisioning model gives you full control over
your VM instances' runtime.
.RE
.sp
.TP 2m
\fB\-\-[no\-]restart\-on\-failure\fR
The instances will be restarted if they are terminated by Compute Engine. This
does not affect terminations performed by the user. This option is mutually
exclusive with \-\-preemptible. Use \fB\-\-restart\-on\-failure\fR to enable and
\fB\-\-no\-restart\-on\-failure\fR to disable.
.TP 2m
\fB\-\-[no\-]skip\-guest\-os\-shutdown\fR
If enabled, then, when the instance is stopped or deleted, the instance is
immediately stopped without giving time to the guest OS to cleanly shut down.
Use \fB\-\-skip\-guest\-os\-shutdown\fR to enable and
\fB\-\-no\-skip\-guest\-os\-shutdown\fR to disable.
.TP 2m
\fB\-\-zone\fR=\fIZONE\fR
Zone of the instance to operate on. If not specified, you might be prompted to
select a zone (interactive mode only). \f5gcloud\fR attempts to identify the
appropriate zone by searching for resources in your currently active project. If
the zone cannot be determined, \f5gcloud\fR 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
\f5\fIcompute/zone\fR\fR property:
.RS 2m
$ gcloud config set compute/zone ZONE
.RE
A list of zones can be fetched by running:
.RS 2m
$ gcloud compute zones list
.RE
To unset the property, run:
.RS 2m
$ gcloud config unset compute/zone
.RE
Alternatively, the zone can be stored in the environment variable
\f5\fICLOUDSDK_COMPUTE_ZONE\fR\fR.
.TP 2m
Discard Local SSDs At Termination Timestamp
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-clear\-discard\-local\-ssds\-at\-termination\-timestamp\fR
Removes the discard\-local\-ssds\-at\-termination\-timestamp field from the
scheduling options.
.TP 2m
\fB\-\-discard\-local\-ssds\-at\-termination\-timestamp\fR=\fIDISCARD_LOCAL_SSDS_AT_TERMINATION_TIMESTAMP\fR
Required to be set to \f5true\fR 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
\f5\-\-discard\-local\-ssd\fR flag in the automatic \f5gcloud compute instances
stop\fR command. This flag only supports the \f5true\fR value, which discards
local SSD data when automatically stopping this VM during its
\f5terminationTimestamp\fR.
For more information about the \f5\-\-discard\-local\-ssd\fR flag, see
https://cloud.google.com/compute/docs/disks/local\-ssd#stop_instance.
.RE
.sp
.TP 2m
Instance Termination Action
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-clear\-instance\-termination\-action\fR
Disables the termination action for this VM if allowed OR sets termination
action to the default value. Depending on a VM's availability settings, a
termination action is either required or not allowed. This flag is required when
you are updating a VM such that it's previously specified termination action is
no longer allowed. If you use this flag when a VM requires a termination action,
it's termination action is just set to the default value (stop).
.TP 2m
\fB\-\-instance\-termination\-action\fR=\fIINSTANCE_TERMINATION_ACTION\fR
Specifies the termination action that will be taken upon VM preemption
(\-\-provisioning\-model=SPOT) or automatic instance termination
(\-\-max\-run\-duration or \-\-termination\-time).
\fIINSTANCE_TERMINATION_ACTION\fR must be one of:
.RS 2m
.TP 2m
\fBDELETE\fR
Permanently delete the VM.
.TP 2m
\fBSTOP\fR
Default only for Spot VMs. Stop the VM without preserving memory. The VM can be
restarted later.
.RE
.sp
.RE
.sp
.TP 2m
Max Run Duration
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-clear\-max\-run\-duration\fR
Removes the max\-run\-duration field from the scheduling options.
.TP 2m
\fB\-\-max\-run\-duration\fR=\fIMAX_RUN_DURATION\fR
Limits how long this VM instance can run, specified as a duration relative to
the last time when the VM began running. Format the duration, MAX_RUN_DURATION,
as the number of days, hours, minutes, and seconds followed by d, h, m, and s
respectively. For example, specify \f530m\fR for a duration of 30 minutes or
specify \f51d2h3m4s\fR 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 (\f5terminationTimestamp\fR) using
the action specified by \-\-instance\-termination\-action.
Note: The \f5terminationTimestamp\fR is removed whenever the VM is stopped or
suspended and redefined whenever the VM is rerun. For \-\-max\-run\-duration
specifically, the \f5terminationTimestamp\fR is the sum of MAX_RUN_DURATION and
the time when the VM last entered the \f5RUNNING\fR state, which changes
whenever the VM is rerun.
.RE
.sp
.TP 2m
Sole Tenancy.
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-clear\-node\-affinities\fR
Removes the node affinities field from the instance. If specified, the instance
node settings will be cleared. The instance will not be scheduled onto a
sole\-tenant node.
.TP 2m
\fB\-\-node\fR=\fINODE\fR
The name of the node to schedule this instance on.
.TP 2m
\fB\-\-node\-affinity\-file\fR=\fIPATH_TO_FILE\fR
The JSON/YAML file containing the configuration of desired nodes onto which this
instance could be scheduled. These rules filter the nodes according to their
node affinity labels. A node's affinity labels come from the node template of
the group the node is in.
The file should contain a list of a JSON/YAML objects. For an example, see
https://cloud.google.com/compute/docs/nodes/provisioning\-sole\-tenant\-vms#configure_node_affinity_labels.
The following list describes the fields:
.RS 2m
.TP 2m
\fBkey\fR
Corresponds to the node affinity label keys of the Node resource.
.TP 2m
\fBoperator\fR
Specifies the node selection type. Must be one of: \f5IN\fR: Requires Compute
Engine to seek for matched nodes. \f5NOT_IN\fR: Requires Compute Engine to avoid
certain nodes.
.TP 2m
\fBvalues\fR
Optional. A list of values which correspond to the node affinity label values of
the Node resource.
Use a full or relative path to a local file containing the value of
node_affinity_file.
.RE
.sp
.TP 2m
\fB\-\-node\-group\fR=\fINODE_GROUP\fR
The name of the node group to schedule this instance on.
.RE
.sp
.TP 2m
Termination Time
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-clear\-termination\-time\fR
Removes the termination\-time field from the scheduling options.
.TP 2m
\fB\-\-termination\-time\fR=\fITERMINATION_TIME\fR
Limits how long this VM instance can run, specified as a time. Format the time,
TERMINATION_TIME, as a RFC 3339 timestamp. For more information, see
https://tools.ietf.org/html/rfc3339. Alternatively, to specify a duration, use
\-\-max\-run\-duration instead.
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 (\f5terminationTimestamp\fR) using
the action specified by \-\-instance\-termination\-action.
Note: The \f5terminationTimestamp\fR is removed whenever the VM is stopped or
suspended and redefined whenever the VM is rerun. For \-\-termination\-time
specifically, the \f5terminationTimestamp\fR remains the same whenever the VM is
rerun, but any requests to rerun the VM fail if the specified timestamp is in
the past.
.RE
.sp
.TP 2m
Maintenance Behavior.
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-maintenance\-policy\fR=\fIMAINTENANCE_POLICY\fR
(DEPRECATED) Specifies the behavior of the VMs when their host machines undergo
maintenance. The default is MIGRATE. For more information, see
https://cloud.google.com/compute/docs/instances/host\-maintenance\-options.
The \-\-maintenance\-policy flag is now deprecated. Please use
\f5\-\-on\-host\-maintenance\fR instead. \fIMAINTENANCE_POLICY\fR must be one
of:
.RS 2m
.TP 2m
\fBMIGRATE\fR
The instances should be migrated to a new host. This will temporarily impact the
performance of instances during a migration event.
.TP 2m
\fBTERMINATE\fR
The instances should be terminated.
.RE
.sp
.TP 2m
\fB\-\-on\-host\-maintenance\fR=\fIMAINTENANCE_POLICY\fR
Specifies the behavior of the VMs when their host machines undergo maintenance.
The default is MIGRATE. For more information, see
https://cloud.google.com/compute/docs/instances/host\-maintenance\-options.
\fIMAINTENANCE_POLICY\fR must be one of:
.RS 2m
.TP 2m
\fBMIGRATE\fR
The instances should be migrated to a new host. This will temporarily impact the
performance of instances during a migration event.
.TP 2m
\fBTERMINATE\fR
The instances should be terminated.
.RE
.sp
.RE
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
This command is currently in alpha and might change without notice. If this
command fails with API permission errors despite specifying the correct project,
you might be trying to access an API with an invitation\-only early access
allowlist. These variants are also available:
.RS 2m
$ gcloud compute instances set\-scheduling
.RE
.RS 2m
$ gcloud beta compute instances set\-scheduling
.RE