NAME

gcloud compute instances set-scheduling - set scheduling options for Compute Engine virtual machines

SYNOPSIS

gcloud compute instances set-scheduling INSTANCE_NAME [--clear-min-node-cpu] [--maintenance-policy=MAINTENANCE_POLICY] [--min-node-cpu=MIN_NODE_CPU] [--[no-]preemptible] [--provisioning-model=PROVISIONING_MODEL] [--[no-]restart-on-failure] [--zone=ZONE] [--clear-instance-termination-action | --instance-termination-action=INSTANCE_TERMINATION_ACTION] [--clear-node-affinities | --node=NODE | --node-affinity-file=NODE_AFFINITY_FILE | --node-group=NODE_GROUP] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION

$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).

EXAMPLES

To set instance to be terminated during maintenance, run:

$ gcloud compute instances set-scheduling example-instance \ --maintenance-policy=TERMINATE --zone=us-central1-b

POSITIONAL ARGUMENTS

INSTANCE_NAME

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

FLAGS

--clear-min-node-cpu

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.

--maintenance-policy=MAINTENANCE_POLICY

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. MAINTENANCE_POLICY must be one of:

MIGRATE

The instances should be migrated to a new host. This will temporarily impact the performance of instances during a migration event.

TERMINATE

The instances should be terminated.

--min-node-cpu=MIN_NODE_CPU

Minimum number of virtual CPUs this instance will consume when running on a sole-tenant node.

--[no-]preemptible

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 --preemptible to enable and --no-preemptible to disable.

--provisioning-model=PROVISIONING_MODEL

Specifies provisioning model, which determines price, obtainability, and runtime for the VM instance. PROVISIONING_MODEL must be one of:

SPOT

Spot VMs are spare capacity; Spot VMs are discounted to have much lower prices than standard VMs but have no guaranteed runtime. Spot VMs are the new version of preemptible VM instances, except Spot VMs do not have a 24-hour maximum runtime.

STANDARD

Default. Standard provisioning model for VM instances, which has user-controlled runtime but no Spot discounts.

--[no-]restart-on-failure

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 --restart-on-failure to enable and --no-restart-on-failure to disable.

--zone=ZONE

Zone of the instance to operate on. If not specified, you might be prompted to select a zone (interactive mode only). gcloud 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 compute/zone property:

$ gcloud config set compute/zone ZONE

A list of zones can be fetched by running:

$ gcloud compute zones list

To unset the property, run:

$ gcloud config unset compute/zone

Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.

Instance Termination Action

At most one of these can be specified:

--clear-instance-termination-action

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).

--instance-termination-action=INSTANCE_TERMINATION_ACTION

Specifies the termination action that will be taken upon VM preemption (--provisioning-model=SPOT or --preemptible) or automatic instance termination (--max-run-duration or --termination-time). INSTANCE_TERMINATION_ACTION must be one of:

DELETE

Permanently delete the VM.

STOP

Default. Stop the VM without preserving memory. The VM can be restarted later.

Sole Tenancy.

At most one of these can be specified:

--clear-node-affinities

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.

--node=NODE

The name of the node to schedule this instance on.

--node-affinity-file=NODE_AFFINITY_FILE

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:

key

Corresponds to the node affinity label keys of the Node resource.

operator

Specifies the node selection type. Must be one of: IN: Requires Compute Engine to seek for matched nodes. NOT_IN: Requires Compute Engine to avoid certain nodes.

values

Optional. A list of values which correspond to the node affinity label values of the Node resource.

--node-group=NODE_GROUP

The name of the node group to schedule this instance on.

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 help for details.

NOTES

These variants are also available:

$ gcloud alpha compute instances set-scheduling

$ gcloud beta compute instances set-scheduling