gcloud compute migration machine-image-imports create

NAME
gcloud compute migration machine-image-imports create - import machine images to Google Compute Engine
SYNOPSIS
gcloud compute migration machine-image-imports create(IMAGE_IMPORT_NAME :--location=LOCATION)--source-file=SOURCE_FILE[--additional-licenses=[ADDITIONAL_LICENSES,…]][--description=DESCRIPTION][--kms-key=KMS_KEY][--labels=[KEY=VALUE,…]][--machine-image-name=MACHINE_IMAGE_NAME][--machine-type=MACHINE_TYPE][--network-interface=[network=NETWORK],[networkTier=NETWORKTIER],[subnetwork=SUBNETWORK]][--single-region-storage][--tags=[TAGS,…]][--target-project=TARGET_PROJECT][--enable-integrity-monitoring--enable-vtpm--secure-boot=SECURE_BOOT][--scopes=[SCOPES,…]--service-account=SERVICE_ACCOUNT][--skip-os-adaptation    |--adaptation-modifiers=ADAPTATION_MODIFIERS--boot-conversion=BOOT_CONVERSION--generalize--license-type=LICENSE_TYPE--rootfs-uuid=ROOTFS_UUID][GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute migration machine-image-imports create Imports machine imagessuch as OVA and OVF files, from a Google Cloud Storage file (gs://…) toGoogle Compute Engine, using the Migrate to Virtual Machines service API. Thiscommand creates an Image Import resource with a nested Image Import Jobresource. The Image Import Job resource tracks the image import progress. To usethis command, you must enable VM Migration API in your project.
EXAMPLES
To import ub-14.04.5.ova from my-images-bucket to my-target-project inus-central1, create my-image-import resource in my-project in us-central1. Run:
gcloudcomputemigrationmachine-image-importscreatemy-machine-image-import--source-file=gs://my-images-bucket/ub-14.04.5.ova--image-name=my-ubuntu-machine-image--location=us-central1--target-project=projects/my-project/locations/global/targetProjects/my-target-project--project=my-project
POSITIONAL ARGUMENTS
Image import resource - The Image Import resource you want to create. This wouldbe the machine image name if --machine-image-name is not given. The arguments inthis group can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.

To set theproject attribute:

  • provide the argumentimage_import_name on the command line with afully specified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

IMAGE_IMPORT_NAME
ID of the image_import or fully qualified identifier for the image_import.

To set theimage_import_name attribute:

  • provide the argumentimage_import_name on the command line.

This positional argument must be specified if any of the other arguments in thisgroup are specified.

--location=LOCATION
Resource location.

To set thelocation attribute:

  • provide the argumentimage_import_name on the command line with afully specified name;
  • provide the argument--location on the command line;
  • set the propertycompute/region.
REQUIRED FLAGS
--source-file=SOURCE_FILE
The path to the Google Cloud Storage file from which the image should beimported.
OPTIONAL FLAGS
--additional-licenses=[ADDITIONAL_LICENSES,…]
Comma-separated list of the additional licenses to assign to the machine image.
--description=DESCRIPTION
A description of the machine image.
--kms-key=KMS_KEY
Fully qualified identifier for the Cloud KMS (Key Management Service) cryptokeythat will be used to protect the image.
--labels=[KEY=VALUE,…]
A map of labels to associate with the machine image.
--machine-image-name=MACHINE_IMAGE_NAME
The name of the machine image that will be imported to Google Compute Engine.Default is the Image Import name.
--machine-type=MACHINE_TYPE
The machine type to create the machine image with. If not provided, the servicewill choose a relevant machine type series based on the information from thesource image.
--network-interface=[network=NETWORK],[networkTier=NETWORKTIER],[subnetwork=SUBNETWORK]
The network interface to use for the instance created by the machine image. Thisis a dicionary with the following keys:
  • network: The network to use for this network interface.
  • subnetwork: The subnetwork to use for this network interface.
  • network-tier: The network tier to use for this network interface. This argumentcan be specified multiple times in case of multiple nics.
--single-region-storage
If true, the location of the imported machine image will be the region of theimport job. Otherwise the closest multi-region is selected. Default is false.
--tags=[TAGS,…]
The tags to apply to the instance created by the machine image.
--target-project=TARGET_PROJECT
The target project resource path to which the machine image will be imported.Default is the host project. To get a list of the target projects run the gcloudalpha migration vms target-projects list command.
Shielded instance configuration.
--enable-integrity-monitoring
Defines whether the instance created by the machine image has integritymonitoring enabled. This can be set to true only if the image boot option isEFI, and vTPM is enabled.
--enable-vtpm
Defines whether the instance created by the machine image has vTPM enabled. Thiscan be set to true only if the image boot option is EFI.
--secure-boot=SECURE_BOOT
Defines whether the instance created by the machine image has Secure Bootenabled. This can be set to true only if the image boot option is EFI. If notspecified we will use the configuration of the source.SECURE_BOOT must be one of:false,secure-boot-unspecified,true.
The service account to assign to the instance created by the machine image.
--scopes=[SCOPES,…]
The list of scopes to be made available for the service account.
--service-account=SERVICE_ACCOUNT
The email address of the service account.
OS adaptation parameters.

At most one of these can be specified:

--skip-os-adaptation
If true, skip OS adaptation. Default false.
--adaptation-modifiers=ADAPTATION_MODIFIERS
A map of flags to pass to the OS adaptation process. The actual value depends onthe modifier and can also be empty. e.g.--adaptation-modifiers=flag1=value1,flag2
--boot-conversion=BOOT_CONVERSION
This property will trigger an internal process which will convert the image fromusing the existing boot option to another. The size of the boot disk might beincreased to allow the conversion. Currently only support BIOS_TO_EFI.BOOT_CONVERSION must be one of:bios-to-efi,boot-conversion-unspecified,none.
--generalize
If true, generalize the imported machine image. Default false. Thegeneralization process enables co-existence of multiple VMs created from thesame machine image. For Windows, generalizing the machine image removescomputer-specific information such as installed drivers and the computersecurity identifier (SID).
--license-type=LICENSE_TYPE
The license to use post migration.LICENSE_TYPE must beone of:compute-engine-license-type-byol,compute-engine-license-type-default,compute-engine-license-type-payg.
--rootfs-uuid=ROOTFS_UUID
Identifies the file system to adapt.
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.

API REFERENCE
This command uses thevmmigration/v1 API. The full documentationfor this API can be found at:https://cloud.google.com/migrate/virtual-machines
NOTES
This variant is also available:
gcloudalphacomputemigrationmachine-image-importscreate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-05 UTC.