gcloud compute instances create INSTANCE_NAMES [INSTANCE_NAMES …] [--accelerator=[count=COUNT],[type=TYPE]] [--async] [--availability-domain=AVAILABILITY_DOMAIN] [--no-boot-disk-auto-delete] [--boot-disk-device-name=BOOT_DISK_DEVICE_NAME] [--boot-disk-interface=BOOT_DISK_INTERFACE] [--boot-disk-provisioned-iops=BOOT_DISK_PROVISIONED_IOPS] [--boot-disk-provisioned-throughput=BOOT_DISK_PROVISIONED_THROUGHPUT] [--boot-disk-size=BOOT_DISK_SIZE] [--boot-disk-type=BOOT_DISK_TYPE] [--can-ip-forward] [--create-disk=[PROPERTY=VALUE,…]] [--csek-key-file=FILE] [--deletion-protection] [--description=DESCRIPTION] [--discard-local-ssds-at-termination-timestamp=DISCARD_LOCAL_SSDS_AT_TERMINATION_TIMESTAMP] [--disk=[auto-delete=AUTO-DELETE],[boot=BOOT],[device-name=DEVICE-NAME],[force-attach=FORCE-ATTACH],[interface=INTERFACE],[mode=MODE],[name=NAME],[scope=SCOPE]] [--enable-display-device] [--[no-]enable-nested-virtualization] [--[no-]enable-uefi-networking] [--erase-windows-vss-signature] [--external-ipv6-address=EXTERNAL_IPV6_ADDRESS] [--external-ipv6-prefix-length=EXTERNAL_IPV6_PREFIX_LENGTH] [--host-error-timeout-seconds=HOST_ERROR_TIMEOUT_SECONDS] [--hostname=HOSTNAME] [--identity=IDENTITY] [--[no-]identity-certificate] [--instance-termination-action=INSTANCE_TERMINATION_ACTION] [--internal-ipv6-address=INTERNAL_IPV6_ADDRESS] [--internal-ipv6-prefix-length=INTERNAL_IPV6_PREFIX_LENGTH] [--ipv6-network-tier=IPV6_NETWORK_TIER] [--ipv6-public-ptr-domain=IPV6_PUBLIC_PTR_DOMAIN] [--key-revocation-action-type=POLICY] [--labels=[KEY=VALUE,…]] [--local-ssd=[device-name=DEVICE-NAME],[interface=INTERFACE],[size=SIZE]] [--local-ssd-encryption-mode=LOCAL_SSD_ENCRYPTION_MODE] [--local-ssd-recovery-timeout=LOCAL_SSD_RECOVERY_TIMEOUT] [--machine-type=MACHINE_TYPE] [--maintenance-policy=MAINTENANCE_POLICY] [--max-run-duration=MAX_RUN_DURATION] [--metadata=KEY=VALUE,[KEY=VALUE,…]] [--metadata-from-file=KEY=LOCAL_FILE_PATH,[…]] [--min-cpu-platform=PLATFORM] [--min-node-cpu=MIN_NODE_CPU] [--network=NETWORK] [--network-interface=[PROPERTY=VALUE,…]] [--network-performance-configs=[PROPERTY=VALUE,…]] [--network-tier=NETWORK_TIER] [--node-project=NODE_PROJECT] [--performance-monitoring-unit=PERFORMANCE_MONITORING_UNIT] [--preemptible] [--private-ipv6-google-access-type=PRIVATE_IPV6_GOOGLE_ACCESS_TYPE] [--private-network-ip=PRIVATE_NETWORK_IP] [--provisioning-model=PROVISIONING_MODEL] [--request-valid-for-duration=REQUEST_VALID_FOR_DURATION] [--no-require-csek-key-create] [--resource-manager-tags=[KEY=VALUE,…]] [--resource-policies=[RESOURCE_POLICY,…]] [--no-restart-on-failure] [--shielded-integrity-monitoring] [--shielded-secure-boot] [--shielded-vtpm] [--[no-]skip-guest-os-shutdown] [--source-instance-template=SOURCE_INSTANCE_TEMPLATE] [--source-machine-image=SOURCE_MACHINE_IMAGE] [--source-machine-image-csek-key-file=FILE] [--stack-type=STACK_TYPE] [--subnet=SUBNET] [--tags=TAG,[TAG,…]] [--termination-time=TERMINATION_TIME] [--threads-per-core=THREADS_PER_CORE] [--turbo-mode=TURBO_MODE] [--visible-core-count=VISIBLE_CORE_COUNT] [--zone=ZONE] [--address=ADDRESS | --no-address] [--boot-disk-kms-key=BOOT_DISK_KMS_KEY : --boot-disk-kms-keyring=BOOT_DISK_KMS_KEYRING --boot-disk-kms-location=BOOT_DISK_KMS_LOCATION --boot-disk-kms-project=BOOT_DISK_KMS_PROJECT] [--confidential-compute | --confidential-compute-type=CONFIDENTIAL_COMPUTE_TYPE] [--custom-cpu=CUSTOM_CPU --custom-memory=CUSTOM_MEMORY : --custom-extensions --custom-vm-type=CUSTOM_VM_TYPE] [--image-family-scope=IMAGE_FAMILY_SCOPE --image-project=IMAGE_PROJECT --image=IMAGE | --image-family=IMAGE_FAMILY | --source-snapshot=SOURCE_SNAPSHOT] [--instance-kms-key=INSTANCE_KMS_KEY : --instance-kms-keyring=INSTANCE_KMS_KEYRING --instance-kms-location=INSTANCE_KMS_LOCATION --instance-kms-project=INSTANCE_KMS_PROJECT] [--node=NODE | --node-affinity-file=PATH_TO_FILE | --node-group=NODE_GROUP] [--public-ptr | --no-public-ptr] [--public-ptr-domain=PUBLIC_PTR_DOMAIN | --no-public-ptr-domain] [--reservation=RESERVATION --reservation-affinity=RESERVATION_AFFINITY; default="any"] [--scopes=[SCOPE,…] | --no-scopes] [--service-account=SERVICE_ACCOUNT | --no-service-account] [GCLOUD_WIDE_FLAG …]
gcloud compute instances create facilitates the creation of Compute
Engine virtual machines.
When an instance is in RUNNING state and the system begins to boot, the instance
creation is considered finished, and the command returns with a list of new
virtual machines. Note that you usually cannot log into a new instance until it
finishes booting. Check the progress of an instance using gcloud
compute instances get-serial-port-output.
EXAMPLES section below.
gcloud compute instances create example-instance --image-family=rhel-8 --image-project=rhel-cloud --zone=us-central1-aTo create instances called 'example-instance-1', 'example-instance-2', and 'example-instance-3' in the 'us-central1-a' zone, run:
gcloud compute instances create example-instance-1 example-instance-2 example-instance-3 --zone=us-central1-aTo create an instance called 'instance-1' from a source snapshot called 'instance-snapshot' in zone 'us-central1-a' and attached regional disk 'disk-1', run:
gcloud compute instances create instance-1 --source-snapshot=https://compute.googleapis.com/compute/v1/projects/myproject/global/snapshots/instance-snapshot --zone=us-central1-a --disk=name=disk1,scope=regionalTo create an instance called instance-1 as a Shielded VM instance with Secure Boot, virtual trusted platform module (vTPM) enabled and integrity monitoring, run:
gcloud compute instances create instance-1 --zone=us-central1-a --shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoringTo create a preemptible instance called 'instance-1', run:
gcloud compute instances create instance-1 --machine-type=n1-standard-1 --zone=us-central1-b --preemptible --no-restart-on-failure --maintenance-policy=terminateINSTANCE_NAMES [INSTANCE_NAMES …]--accelerator=[count=COUNT],[type=TYPE]typecount--async--availability-domain=AVAILABILITY_DOMAIN--boot-disk-auto-delete--no-boot-disk-auto-delete to disable.
--boot-disk-device-name=BOOT_DISK_DEVICE_NAME--boot-disk-interface=BOOT_DISK_INTERFACE--boot-disk-provisioned-iops=BOOT_DISK_PROVISIONED_IOPS--boot-disk-provisioned-throughput=BOOT_DISK_PROVISIONED_THROUGHPUT--boot-disk-size=BOOT_DISK_SIZEKB for kilobyte,
MB for megabyte,
GB for gigabyte, or
TB for terabyte. For example,
10GB will produce a 10 gigabyte disk. Disk
size must be a multiple of 1 GB. Default size unit is
GB.
--boot-disk-type=BOOT_DISK_TYPE$ gcloud compute disk-types
list.
--can-ip-forward--create-disk=[PROPERTY=VALUE,…]namedescriptionmodero for read-only and
rw for read-write. If omitted,
rw is used as a default.
image$ gcloud compute images
list. It is best practice to use image when a specific version of an
image is needed. If both image and image-family flags are omitted a blank disk
will be created.
image-familyimage-projectgcloud compute images
list.
sizeKB for kilobyte,
MB for megabyte,
GB for gigabyte, or
TB for terabyte. For example,
10GB will produce a 10 gigabyte disk. Disk
size must be a multiple of 1 GB. If not specified, the default image size will
be used for the new disk.
typepd-standard.
device-namepersistent-disk-N is used.
provisioned-iopsprovisioned-throughputdisk-resource-policyhttps://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/resourcePolicies/my-resource-policy
projects/my-project/regions/us-central1/resourcePolicies/my-resource-policy
auto-deleteyes, this persistent disk will be
automatically deleted when the instance is deleted. However, if the disk is
later detached from the instance, this option won't apply. The default value for
this is yes.
architecturestorage-poolinterfaceon-update-actionbootyes, indicates that this is a boot disk.
The instance will use the first partition of the disk for its root file system.
The default value for this is no.
kms-keyThis can either be the fully qualified path or the name.
The fully qualified Cloud KMS cryptokey name format is:
.
projects/<kms-project>/locations/<kms-location>/keyRings/<kms-keyring>/
cryptoKeys/<key-name>
If the value is not fully qualified then kms-location, kms-keyring, and optionally kms-project are required.
See https://cloud.google.com/compute/docs/disks/customer-managed-encryption for more details.kms-projectIf the project is not specified then the project where the disk is being created will be used.
If this flag is set then key-location, kms-keyring, and kms-key are required.
See https://cloud.google.com/compute/docs/disks/customer-managed-encryption for more details.kms-locationkms-keyringIf this flag is set then kms-location and kms-key are required.
See https://cloud.google.com/compute/docs/disks/customer-managed-encryption for more details.source-snapshotconfidential-computeyes, the disk is created in confidential
mode. The default value is no. Encryption
with a Cloud KMS key is required to enable this option.
replica-zones--csek-key-file=FILEIf you pass `-` as value of the flag, the CSEK is read from stdin. See https://cloud.google.com/compute/docs/disks/customer-supplied-encryption for more details.
--deletion-protection--description=DESCRIPTION--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.
--disk=[auto-delete=AUTO-DELETE],[boot=BOOT],[device-name=DEVICE-NAME],[force-attach=FORCE-ATTACH],[interface=INTERFACE],[mode=MODE],[name=NAME],[scope=SCOPE]nameprojects/myproject/regions/us-central1/disks/my-regional-disk.
modero for read-only mode and
rw for read-write mode. If omitted,
rw is used as a default value. If you use
rw when creating more than one instance,
you encounter errors.
bootyes, you attach a boot disk. The
virtual machine then uses the first partition of the disk for the root file
systems. The default value for this is no.
device-namepersistent-disk-N is used.
auto-deleteyes, the persistent disk is
automatically deleted when the instance is deleted. However, if you detach the
disk from the instance, deleting the instance doesn't delete the disk. The
default value is yes.
interfacescopezonal or regional. If
zonal, the disk is interpreted as a zonal
disk in the same zone as the instance (default). If
regional, the disk is interpreted as a
regional disk in the same region as the instance. The default value for this is
zonal.
force-attachyes, this persistent disk will
force-attached to the instance even it is already attached to another instance.
The default value is 'no'.
--enable-display-device--[no-]enable-nested-virtualization--enable-nested-virtualization to enable and
--no-enable-nested-virtualization to disable.
--[no-]enable-uefi-networking--enable-uefi-networking to enable and
--no-enable-uefi-networking to disable.
--erase-windows-vss-signature--external-ipv6-address=EXTERNAL_IPV6_ADDRESS--external-ipv6-prefix-length=EXTERNAL_IPV6_PREFIX_LENGTH--external-ipv6-address. Only the /96 IP address
range is supported, and the default value is 96.
--host-error-timeout-seconds=HOST_ERROR_TIMEOUT_SECONDS--hostname=HOSTNAME--identity=IDENTITY--[no-]identity-certificate--identity-certificate to enable and
--no-identity-certificate to disable.
--instance-termination-action=INSTANCE_TERMINATION_ACTIONINSTANCE_TERMINATION_ACTION must be one of:
DELETESTOP--internal-ipv6-address=INTERNAL_IPV6_ADDRESS--internal-ipv6-prefix-length=INTERNAL_IPV6_PREFIX_LENGTH--ipv6-network-tier=IPV6_NETWORK_TIERIPV6_NETWORK_TIER
must be (only one value is supported):
PREMIUM--ipv6-public-ptr-domain=IPV6_PUBLIC_PTR_DOMAINnic0.
--key-revocation-action-type=POLICYPOLICY must be
one of:
nonestop--labels=[KEY=VALUE,…]-), underscores (_), lowercase characters, and
numbers. Values must contain only hyphens (-), underscores
(_), lowercase characters, and numbers.
--local-ssd=[device-name=DEVICE-NAME],[interface=INTERFACE],[size=SIZE]device-nameinterface is SCSI. If
omitted, a device name of the form
local-ssd-N will be used.
interfaceSCSI and
NVME. SCSI is the default and is supported
by more guest operating systems. NVME might provide higher performance.
size375GB.
Specify the --local-ssd flag multiple times
if you need multiple 375GB local SSD
partitions. You can specify a maximum of 24 local SSDs for a maximum of
9TB attached to an instance.
--local-ssd-encryption-mode=LOCAL_SSD_ENCRYPTION_MODELOCAL_SSD_ENCRYPTION_MODE must be (only one value is
supported): STANDARD_ENCRYPTION.
--local-ssd-recovery-timeout=LOCAL_SSD_RECOVERY_TIMEOUT--machine-type=MACHINE_TYPE--maintenance-policy=MAINTENANCE_POLICYMAINTENANCE_POLICY must be one of:
MIGRATETERMINATE--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.
--metadata=KEY=VALUE,[KEY=VALUE,…]--metadata
key-1=value-1,key-2=value-2,key-3=value-3. The combined
total size for all metadata entries is 512 KB.
In images that have Compute Engine tools installed on them, such as the official images, the
following metadata keys have special meanings:
startup-script--metadata-from-file can be used to pull
the value from a file.
startup-script-urlstartup-script except that the
script contents are pulled from a publicly-accessible location on the web.
For startup scripts on Windows instances, the following metadata keys have
special meanings:
windows-startup-script-url,
windows-startup-script-cmd,
windows-startup-script-bat,
windows-startup-script-ps1,
sysprep-specialize-script-url,
sysprep-specialize-script-cmd,
sysprep-specialize-script-bat, and
sysprep-specialize-script-ps1. For more
information, see Running startup
scripts.
--metadata-from-file=KEY=LOCAL_FILE_PATH,[…]--metadata except that the value
for the entry will be read from a local file. This is useful for values that are
too large such as startup-script contents.
--min-cpu-platform=PLATFORMgcloud compute zones describe ZONE --format="value(availableCpuPlatforms)"Default setting is "AUTOMATIC".
CPU platform selection is available only in selected zones.
You can find more information on-line: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform--min-node-cpu=MIN_NODE_CPU--network=NETWORK--subnet is also specified, subnet must be a subnetwork of the
network specified by this --network flag. If neither is specified,
the default network is used.
--network-interface=[PROPERTY=VALUE,…]--address, --network,
--network-tier, --subnet,
--private-network-ip, --stack-type,
--ipv6-network-tier, --internal-ipv6-address,
--internal-ipv6-prefix-length, --ipv6-address,
--ipv6-prefix-length, --external-ipv6-address,
--external-ipv6-prefix-length,
--ipv6-public-ptr-domain. This flag can be repeated to specify
multiple network interfaces.
The following keys are allowed:
addressnetworkno-addressnetwork-tierNETWORK_TIER must be one of:
PREMIUM, STANDARD. The default value is
PREMIUM.
private-network-ipsubnetnic-typeNIC_TYPE must be one of:
GVNIC, VIRTIO_NET.
queue-countstack-typeSTACK_TYPE must be one of:
IPV4_ONLY, IPV4_IPV6, IPV6_ONLY. The
default value is IPV4_ONLY.
ipv6-network-tierIPV6_NETWORK_TIER must be
PREMIUM (currently only one value is supported).
internal-ipv6-addressinternal-ipv6-prefix-lengthexternal-ipv6-addressexternal-ipv6-prefix-lengthipv6-public-ptr-domainnic0.
aliasesFor example:
--aliases="10.128.1.0/24;range1:/32"
192.168.100.0/24), a single IP address (e.g.
192.168.100.1), or a netmask in CIDR format (e.g.
/24). If the IP range is specified by CIDR range or single IP
address, it must belong to the CIDR range specified by the range name on the
subnet. If the IP range is specified by netmask, the IP allocator will pick an
available range with the specified netmask and allocate it to this network
interface.
network-attachment--network and --subnet flags.
service-class-idvlanigmp-queryIGMP_QUERY must be one of:
IGMP_QUERY_V2, IGMP_QUERY_DISABLED. It is disabled by
default.
--network-performance-configs=[PROPERTY=VALUE,…]total-egress-bandwidth-tier--network-tier=NETWORK_TIERNETWORK_TIER must be one of:
PREMIUM, STANDARD. The default value is
PREMIUM.
--node-project=NODE_PROJECT--performance-monitoring-unit=PERFORMANCE_MONITORING_UNITPERFORMANCE_MONITORING_UNIT must be one of:
architecturalenhancedstandard--preemptible--private-ipv6-google-access-type=PRIVATE_IPV6_GOOGLE_ACCESS_TYPEPRIVATE_IPV6_GOOGLE_ACCESS_TYPE must be one of:
enable-bidirectional-access,
enable-outbound-vm-access, inherit-subnetwork.
--private-network-ip=PRIVATE_NETWORK_IP--provisioning-model=PROVISIONING_MODELPROVISIONING_MODEL must be one of:
FLEX_STARTRESERVATION_BOUNDSPOTSTANDARD--request-valid-for-duration=REQUEST_VALID_FOR_DURATIONh, m,
and s for hours, minutes, and seconds, respectively. For example,
specify 30m for a duration of 30 minutes, or 1h2m3s
for 1 hour, 2 minutes, and 3 seconds. Longer durations give you higher chances
that your instance creation request succeeds when resources are in high demand.
--require-csek-key-create--no-require-csek-key-create to disable.
--resource-manager-tags=[KEY=VALUE,…]--resource-policies=[RESOURCE_POLICY,…]--restart-on-failure--no-restart-on-failure to disable.
--shielded-integrity-monitoringgcloud compute instances
update --shielded-learn-integrity-policy. On Shielded VM instances,
integrity monitoring is enabled by default. For information about how to modify
Shielded VM options, see https://cloud.google.com/compute/docs/instances/modifying-shielded-vm.
For information about monitoring integrity on Shielded VM instances, see
https://cloud.google.com/compute/docs/instances/integrity-monitoring."
--shielded-secure-boot--shielded-vtpm--[no-]skip-guest-os-shutdown--skip-guest-os-shutdown to enable and
--no-skip-guest-os-shutdown to disable.
--source-instance-template=SOURCE_INSTANCE_TEMPLATE--source-machine-image=SOURCE_MACHINE_IMAGE--source-machine-image-csek-key-file=FILE--stack-type=STACK_TYPESTACK_TYPE must be
one of:
IPV4_IPV6IPV4_ONLYIPV6_ONLY--subnet=SUBNET--network is also specified, subnet must be a subnetwork of the
network specified by the --network flag.
--tags=TAG,[TAG,…]gcloud compute
firewall-rules create(1) for more details.
To read more about configuring network tags, read this guide: https://cloud.google.com/vpc/docs/add-remove-network-tags
To list instances with their respective status and tags, run:
gcloud compute instances list --format='table(name,status,tags.list())'
To list instances tagged with a specific tag, tag1, run:
gcloud compute instances list --filter='tags:tag1'--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.
--threads-per-core=THREADS_PER_CORE--turbo-mode=TURBO_MODE--visible-core-count=VISIBLE_CORE_COUNT--zone=ZONEcompute/zone property isn't set, you might
be prompted to select a zone (interactive mode only).
To avoid prompting when this flag is omitted, you 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.
At most one of these can be specified:
--address=ADDRESS--no-address--boot-disk-kms-key=BOOT_DISK_KMS_KEY
To set the kms-key attribute:
--boot-disk-kms-key on the command line.
--boot-disk-kms-keyring=BOOT_DISK_KMS_KEYRINGkms-keyring attribute:
--boot-disk-kms-key on the command line with a
fully specified name;
--boot-disk-kms-keyring on the command line.
--boot-disk-kms-location=BOOT_DISK_KMS_LOCATIONkms-location attribute:
--boot-disk-kms-key on the command line with a
fully specified name;
--boot-disk-kms-location on the command line.
--boot-disk-kms-project=BOOT_DISK_KMS_PROJECTkms-project attribute:
--boot-disk-kms-key on the command line with a
fully specified name;
--boot-disk-kms-project on the command line;
core/project.
--confidential-compute--confidential-compute-type=SEV instead
--confidential-compute-type=CONFIDENTIAL_COMPUTE_TYPECONFIDENTIAL_COMPUTE_TYPE
must be one of:
SEVSEV_SNPTDX--custom-cpu=CUSTOM_CPU
For some machine types, shared-core values can also be used. For example, for E2
machine types, you can specify micro, small, or
medium.
--custom-memory=CUSTOM_MEMORY--custom-extensions--custom-vm-type=CUSTOM_VM_TYPEn1. For more
information about custom machine types, see: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
--image-family-scope=IMAGE_FAMILY_SCOPE--image-family flag. By default, when
specifying an image family in a public image project, the zonal image family
scope is used. All other projects default to the global image. Use this flag to
override this behavior. IMAGE_FAMILY_SCOPE must be one
of: zonal, global.
--image-project=IMAGE_PROJECTgcloud projects list.
--image=IMAGE$ gcloud compute images
list. It is best practice to use --image when a specific
version of an image is needed.
When using this option,
--boot-disk-device-name and
--boot-disk-size can be used to override
the boot disk's device name and size, respectively.
--image-family=IMAGE_FAMILY--image-family when the latest
version of an image is needed.
By default, debian-12 is assumed for this
flag.
--source-snapshot=SOURCE_SNAPSHOT--instance-kms-key=INSTANCE_KMS_KEY
To set the kms-key attribute:
--instance-kms-key on the command line.
--instance-kms-keyring=INSTANCE_KMS_KEYRINGkms-keyring attribute:
--instance-kms-key on the command line with a
fully specified name;
--instance-kms-keyring on the command line.
--instance-kms-location=INSTANCE_KMS_LOCATIONkms-location attribute:
--instance-kms-key on the command line with a
fully specified name;
--instance-kms-location on the command line.
--instance-kms-project=INSTANCE_KMS_PROJECTkms-project attribute:
--instance-kms-key on the command line with a
fully specified name;
--instance-kms-project on the command line;
core/project.
--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--public-ptr--no-public-ptr--public-ptr-domain=PUBLIC_PTR_DOMAIN--no-public-ptr-domain--reservation=RESERVATION--reservation-affinity=specific.
--reservation-affinity=RESERVATION_AFFINITY; default="any"RESERVATION_AFFINITY must be one of:
anynonespecific--scopes=[SCOPE,…]--scopes nor --no-scopes
are specified and the project has no default service account, then the instance
will be created with no scopes. Note that the level of access that a service
account has is determined by a combination of access scopes and IAM roles so you
must configure both access scopes and IAM roles for the service account to work
properly.
SCOPE can be either the full URI of the scope or an alias. Default
scopes are assigned to all instances. Available aliases are:
DEPRECATION WARNING: https://www.googleapis.com/auth/sqlservice account scope and
Alias URI bigquery https://www.googleapis.com/auth/bigquery cloud-platform https://www.googleapis.com/auth/cloud-platform cloud-source-repos https://www.googleapis.com/auth/source.full_control cloud-source-repos-ro https://www.googleapis.com/auth/source.read_only compute-ro https://www.googleapis.com/auth/compute.readonly compute-rw https://www.googleapis.com/auth/compute datastore https://www.googleapis.com/auth/datastore default https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/logging.write https://www.googleapis.com/auth/monitoring.write https://www.googleapis.com/auth/pubsub https://www.googleapis.com/auth/service.management.readonly https://www.googleapis.com/auth/servicecontrol https://www.googleapis.com/auth/trace.append gke-default https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/logging.write https://www.googleapis.com/auth/monitoring https://www.googleapis.com/auth/service.management.readonly https://www.googleapis.com/auth/servicecontrol https://www.googleapis.com/auth/trace.append logging-write https://www.googleapis.com/auth/logging.write monitoring https://www.googleapis.com/auth/monitoring monitoring-read https://www.googleapis.com/auth/monitoring.read monitoring-write https://www.googleapis.com/auth/monitoring.write pubsub https://www.googleapis.com/auth/pubsub service-control https://www.googleapis.com/auth/servicecontrol service-management https://www.googleapis.com/auth/service.management.readonly sql (deprecated) https://www.googleapis.com/auth/sqlservice sql-admin https://www.googleapis.com/auth/sqlservice.admin storage-full https://www.googleapis.com/auth/devstorage.full_control storage-ro https://www.googleapis.com/auth/devstorage.read_only storage-rw https://www.googleapis.com/auth/devstorage.read_write taskqueue https://www.googleapis.com/auth/taskqueue trace https://www.googleapis.com/auth/trace.append userinfo-email https://www.googleapis.com/auth/userinfo.email
sql alias do not provide SQL instance management
capabilities and have been deprecated. Please, use https://www.googleapis.com/auth/sqlservice.admin
or sql-admin to manage your Google SQL Service instances.
--no-scopes--service-account=SERVICE_ACCOUNT--no-service-account--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 creategcloud beta compute instances creategcloud preview compute instances create
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-07-21 UTC.