gcloud compute instances import

NAME
gcloud compute instances import - create Google Compute Engine virtual machine instances from virtual appliance in OVA/OVF format
SYNOPSIS
gcloud compute instances import INSTANCE_NAME --source-uri=SOURCE_URI [--async] [--can-ip-forward] [--deletion-protection] [--description=DESCRIPTION] [--no-guest-environment] [--hostname=HOSTNAME] [--labels=[KEY=VALUE,…]] [--machine-type=MACHINE_TYPE] [--network=NETWORK] [--network-tier=NETWORK_TIER] [--os=OS] [--private-network-ip=PRIVATE_NETWORK_IP] [--no-restart-on-failure] [--subnet=SUBNET] [--tags=TAG,[TAG,…]] [--timeout=TIMEOUT; default="2h"] [--zone=ZONE] [--custom-cpu=CUSTOM_CPU --custom-memory=CUSTOM_MEMORY : --custom-extensions --custom-vm-type=CUSTOM_VM_TYPE] [--node=NODE     | --node-affinity-file=NODE_AFFINITY_FILE     | --node-group=NODE_GROUP] [GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute instances import creates Google Compute Engine virtual machine instances from virtual appliance in OVA/OVF format.

Importing OVF involves:

  • Unpacking OVF package (if in OVA format) to Cloud Storage.
  • Import disks from OVF to Google Compute Engine.
  • Translate the boot disk to make it bootable in Google Compute Engine.
  • Create a VM instance using OVF metadata and imported disks and boot it.

Virtual machine instances, images and disks in Compute engine and files stored on Cloud Storage incur charges. See https://cloud.google.com/compute/docs/images/importing-virtual-disks#resource_cleanup.

POSITIONAL ARGUMENTS
INSTANCE_NAME
Name of the instance to import. 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
REQUIRED FLAGS
--source-uri=SOURCE_URI
Cloud Storage path to one of: OVF descriptor OVA file Directory with OVF package
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--can-ip-forward
If provided, allows the instances to send and receive packets with non-matching destination or source IP addresses.
--deletion-protection
Enables deletion protection for the instance.
--description=DESCRIPTION
Specifies a textual description of the instances.
--guest-environment
The guest environment will be installed on the instance. Enabled by default, use --no-guest-environment to disable.
--hostname=HOSTNAME
Specify the hostname of the instance to be imported. The specified hostname must be RFC1035 compliant. If hostname is not specified, the default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when using the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS.
--labels=[KEY=VALUE,…]
List of label KEY=VALUE pairs to add.

Keys must start with a lowercase character and contain only hyphens (-), underscores (_), lowercase characters, and numbers. Values must contain only hyphens (-), underscores (_), lowercase characters, and numbers.

--machine-type=MACHINE_TYPE
Specifies the machine type used for the instances. To get a list of available machine types, run 'gcloud compute machine-types list'. If unspecified, the default type is n1-standard-1.
--network=NETWORK
Specifies the network that the instances will be part of. If --subnet is also specified subnet must be a subnetwork of network specified by --network. If neither is specified, this defaults to the "default" network.
--network-tier=NETWORK_TIER
Specifies the network tier that will be used to configure the instance. NETWORK_TIER must be one of: PREMIUM, STANDARD. The default value is PREMIUM.
--os=OS
Specifies the OS of the image being imported. OS must be one of: centos-6, centos-7, debian-8, debian-9, rhel-6, rhel-6-byol, rhel-7, rhel-7-byol, ubuntu-1404, ubuntu-1604, ubuntu-1804, windows-10-x64-byol, windows-10-x86-byol, windows-2008r2, windows-2008r2-byol, windows-2012, windows-2012-byol, windows-2012r2, windows-2012r2-byol, windows-2016, windows-2016-byol, windows-2019, windows-2019-byol, windows-7-x64-byol, windows-7-x86-byol, windows-8-x64-byol, windows-8-x86-byol.
--private-network-ip=PRIVATE_NETWORK_IP
Specifies the RFC1918 IP to assign to the instance. The IP should be in the subnet or legacy network IP range.
--restart-on-failure
The instances will be restarted if they are terminated by Compute Engine. This does not affect terminations performed by the user. Enabled by default, use --no-restart-on-failure to disable.
--subnet=SUBNET
Specifies the subnet that the instances will be part of. If --network is also specified subnet must be a subnetwork of network specified by --network.
--tags=TAG,[TAG,…]
Specifies a list of tags to apply to the instance. These tags allow network firewall rules and routes to be applied to specified VM instances. See 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'
--timeout=TIMEOUT; default="2h"
Maximum time a build can last before it fails as "TIMEOUT". For example, specifying 2h fails the process after 2 hours. See $ gcloud topic datetimes for information about duration formats.
--zone=ZONE
Zone of the instance to import. If not specified and the compute/zone property isn't set, you may be prompted to select a zone.

To avoid prompting when this flag is omitted, you 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.

Custom machine type extensions.
--custom-cpu=CUSTOM_CPU
A whole number value indicating how many cores are desired in the custom machine type. This flag must be specified if any of the other arguments in this group are specified.
--custom-memory=CUSTOM_MEMORY
A whole number value indicating how much memory is desired in the custom machine type. A size unit should be provided (eg. 3072MB or 9GB) - if no units are specified, GB is assumed. This flag must be specified if any of the other arguments in this group are specified.
--custom-extensions
Use the extended custom machine type.
--custom-vm-type=CUSTOM_VM_TYPE
Specifies VM type. n1 - VMs with CPU platforms Skylake and older, n2 - VMs with CPU platform Cascade Lake. n2 offers flexible sizing from 2 to 80 vCPUs, and 1 to 640GBs of memory. It also features a number of performance enhancements including exposing a more accurate NUMA topology to the guest OS. The default is n1.
Sole Tenancy. At most one of these may be specified:
--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 with the following 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: --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.

EXAMPLES
To import an OVF package from Cloud Storage into a VM named my-instance, run:
  $ gcloud compute instances import my-instance \
      --source-uri=gs://my-bucket/my-dir
NOTES
These variants are also available:
  $ gcloud alpha compute instances import
  $ gcloud beta compute instances import