Import virtual disks

Linux Windows

If you have virtual disks in your on-premises environment with software andconfigurations that you need (sometimes referred to asgolden disks orgoldenimages), you can save time by importing those virtual disks intoCompute Engine and using the resulting image tocreate virtual machines.The Migrate to Virtual Machines import tool supports most virtual disk file formats,including VMDK and VHD.

Before you begin

Supported formats

You can import virtual disk image files in the following formats usingMigrate to Virtual Machines:

In addition to these formats, you can also import raw images from a RAW file (.raw), or from a compressed tar file (.tar.gz). When you use a compressed tar file, ensure that it contains a single file nameddisk.raw.

Limitations

You can import disk images with Arm architecture to the following regions:

Region descriptionRegion name
Jurong West, Singaporeasia-southeast1
Tokyo, Japanasia-northeast1
Sydney, Australiaaustralia-southeast1
Stockholm, Swedeneurope-north2
St. Ghislain, Belgiumeurope-west1
London, Englandeurope-west2
Frankfurt, Germanyeurope-west3
Eemshaven, Netherlandseurope-west4
Paris, Franceeurope-west9
Damman, Saudi Arabiame-central2
Tel Aviv, Israelme-west1
Montréal, Québecnorthamerica-northeast1
Queretaro, Mexiconorthamerica-south1
São Paulo, Brazilsouthamerica-east1
Iowa, North Americaus-central1
South Carolina, North Americaus-east1
Virginia, North Americaus-east4
Columbus, North Americaus-east5
Dallas, North Americaus-south1
Oregon, North Americaus-west1
California, North Americaus-west2
Utah, North Americaus-west3
Nevada, North Americaus-west4

Image import process

To import a virtual disk image to a Compute Engine image usingMigrate to Virtual Machines, use the following steps:

  1. Prepare a virtual disk image file for import
  2. Choose a target project
  3. Import a virtual disk image to Compute Engine

Prepare a virtual disk file for import

To import a virtual disk image to a Compute Engine image, you must firstprepare the virtual disk image file for import. The following sections discussthese tasks in detail.

Add the virtual disk image file to Cloud Storage

To import a virtual disk image to a Compute Engine image, you must first addthe virtual disk image file to Cloud Storage. For more information, seeUpload objects from a file system. Forbetter performance, we recommend that you upload the virtual disk image file toa bucket in the same cloud region in which you want to create the image.

Grant the required permissions

To import a virtual disk image to a Compute Engine image, grant permissions asdescribed in the following table.

RolePermissions requiredDescription
Storage Object Viewerroles/storage.objectViewerGrant the default Migrate to Virtual Machines service account in the host project (service-HOST_PROJECT_NUMBER@gcp-sa-vmmigration.iam.gserviceaccount.com) theroles/storage.objectViewer role on the bucket where the image you want to import resides. This permission lets Migrate to Virtual Machines access the source image.
VM Migration Administratorroles/vmmigration.adminIn the host project, grant the user account that you want to use to import the source image theroles/vmmigration.admin role.
VM Migration Service Accountroles/vmmigration.serviceAgentGrant the default Migrate to Virtual Machines service account in the host project (service-HOST_PROJECT_NUMBER@gcp-sa-vmmigration.iam.gserviceaccount.com) theroles/vmmigration.serviceAgent role on the target project. For example, ifservice-1234567890@gcp-sa-vmmigration.iam.gserviceaccount.com is the Migrate to Virtual Machines service account in the host project, you must grant this service account theroles/vmmigration.serviceAgent role to be able to create the image in the target project.

Choose a target project

To host the Compute Engine image, you must create or choose a target project.A target project defines the destination project for a Compute Engine image.For more information on creating or choosing a target project, seeAdding a target project.

Import a virtual disk image to Compute Engine

You can import a virtual disk image to Compute Engine using theGoogle Cloud console, Google Cloud CLI, or REST API commands.

Console

To import a virtual disk image to Compute Engine using the Google Cloud console,use the following steps.

  1. Open the Migrate to Virtual Machines page in the Google Cloud console.
    Go to the Migrate to Virtual Machines page
  2. Select theImage Imports tab.
  3. ClickCreate Image.
  4. Define the characteristics of the image. The following table lists the parameters that you can set for your image.
    Section titleField nameDescription
    GeneralNameThe name of the image that you want to create. For more information on the naming rules, seeNaming convention.
    Image import IDAn ID that represents the image import resource. When you import an image to Compute Engine, Migrate to Virtual Machines first creates an image import resource. The image import resource represents the image import process. You can use the Image import ID to get the link to the image that was imported as part of the image import process.
    Source Cloud Storage fileThe file from which you want to import the image. ClickBrowse to view the list of buckets in your current project, and select the file from which you want to import the image.
    If you want to import an image from a bucket from another project, you must enter the path in the formatbucket/folder/file. To get the path of an object inside a bucket, seeView object metadata. When you copy the path, make sure that you don't copy thegs:// prefix.
    Note that you can only import images from.vmdk and.tar.gz files.
    RegionThe region in which you want to create the image. For a list of supported regions, seeRegions and zones.
    Target projectThe target project in which you want to create the image. If you've not already added a target project, do so using the instructions given inAdd a target project.
    Family(Optional) Select the image family. Compute Engine provides image families to help you make sure that your automation systems can reference the latest images. As an administrator, you can group a set of images as an image family. For more information, seePublic image families.
    Description(Optional) Add a description for the image.
    Skip OS adaptationTo skip OS adaptation, click theSkip OS adaptation toggle to the on position.
    To function properly on Google Cloud, VMs created from imported images require changes to be made to their configuration. These changes are referred to asOS adaptations. Migrate to Virtual Machines performs OS adaptations automatically in the image import process. For more information, seeAdapt VM instances to run on Google Cloud.
    GeneralizeTo generalize the image, click theGeneralize toggle to the on position. When you create an instance from an image, Windows adds some unique information to the instance. Generalize is a process that removes this information so that you can create multiple instances from the same image.
    LicensesLicense typeCompute Engine supports pay as you go (PAYG) licenses and bring your own licenses (BYOL) for your deployed VMs. The default license type for a migrated VM is assigned by Migrate to Virtual Machines based on the migrated operating system, as described inSupported operating systems.
    If your operating system supports multiple license types, you can override the default license type to explicitly specify a license type of PAYG or BYOL.
    Note: Some operating system types, such as CentOS and Debian, don't support a license. Other operating systems only support one type of license. Attempting to set an unsupported license type causes an error when you attempt to import the image.
    Additional licensesAdditional licensesYou can add up to 10 additional licenses to the VM instance created from the imported image using a valid URL format. For example, you can add additional licenses using the following URL format:
    https://www.googleapis.com/compute/beta/projects/windows-sql-cloud/global/licenses/sql-server-2012-enterprise
    LabelsTo organize your project, add labels as key-value pairs to your resources. SeeOrganize resources using labels.
    EncryptionGoogle-managed encryption keyChoose this option to use Google-owned and Google-managed encryption keys to encrypt your data during the import process. For more information, seeencrypts data when it is at rest.
    Customer managed encryption keyChoose this option to use customer-managed encryption keys (CMEK) to encrypt your data during the import process, and the data of the image created by the import process. If you have specific compliance or regulatory requirements related to the keys that protect your data, you can useCMEK to encrypt and decrypt your data. These encryption keys are created, managed, and owned by you. For more information, see Protect resources by using Cloud KMS keys.
    When you add a CMEK, you must grant permissions as described in the following table.
    RolePermissions requiredDescription
    Cloud VM Migration Service Accountroles/vmmigration.serviceAgenGrant this permission to the Compute Engine service account to encrypt data of the image created during the import process.
    Compute Engine Service Agentroles/compute.serviceAgentGrant this permission to the Migrate to Virtual Machines service agent to encrypt the data during the import process.
  5. SelectCreate.

gcloud

To import a virtual disk image to Compute Engine using the Google Cloud CLI,use the following request.

gcloud compute migration image-imports createIMAGE_NAME \--source-file=SOURCE_FILE \--location=REGION_ID \--target-project=projects/HOST_PROJECT_ID/locations/global/targetProjects/TARGET_PROJECT

Replace the following:

  • IMAGE_NAME: the name of the image that you want tocreate. For more information on the naming rules, seeNaming convention.
  • SOURCE_FILE: the file from which you want toimport the image. Enter the path in the formatgs://bucket/folder/file.To get the path of an object inside a bucket, seeView object metadata.Note that you can only import images from.vmdk and.tar.gz files.
  • REGION_ID: the region in which you want the imageimport process to run. The image is created in the closest multi-region.If you want the image to be created in a region, make sure thatsingleRegionStorage is set to true. For a list of supportedregions, seeRegions and Zones.
  • HOST_PROJECT_ID: the name of the host projectfrom which you want to migrate the virtual disk image.
  • TARGET_PROJECT: the target project in which youwant to create the image. If you've not already added a target project,do so using the instructions given inAdd a target project.

For more information, seegcloud compute migration image-imports.

REST

To import a virtual disk image to Compute Engine using the REST API, use thefollowing steps.

  1. Create an image import resource using the following request.

    POST https://vmmigration.googleapis.com/v1/projects/HOST_PROJECT_ID/locations/REGION_ID/imageImports?imageImportId=IMPORT_NAME{"cloudStorageUri": "SOURCE_FILE","diskImageTargetDefaults": {"imageName": "IMAGE_NAME","targetProject": "projects/HOST_PROJECT_ID/locations/global/targetProjects/TARGET_PROJECT",...}}

    Replace the following:

    • HOST_PROJECT_ID: the name of the host projectfrom which you want to migrate the virtual disk image.
    • REGION_ID: the region in which you want the imageimport process to run. The image is created in the closest multi-region.If you want the image to be created in a region, make sure thatsingleRegionStorage is set to true. For a list of supportedregions, seeRegions and Zones.
    • SOURCE_FILE: the file from which you want toimport the image. Enter the path in the formatgs://bucket/folder/file.To get the path of an object inside a bucket, seeView object metadata.Note that you can only import images from.vmdk and.tar.gz files.
    • IMAGE_NAME: the name of the image that you want tocreate. For more information on the naming rules, seeNaming convention.
    • TARGET_PROJECT: the target project in which youwant to create the image. If you've not already added a target project,do so using the instructions given inAdd a target project.

    In this example,IMPORT_NAME is an ID thatrepresents the image import resource. When you import an image toCompute Engine, Migrate to Virtual Machines creates an first creates an imageimport resource. The image import resource represents the image importprocess. You can use theIMPORT_NAME to get thelink to the image that was imported as part of the image import process.

    See the following table for the full list of image import create requestfields supported fields.

    Field nameDescription
    cloudStorageUristring
    The path of the file from which you want to import the image. Enter thepath in the formatgs://bucket/folder/file. To get the path of an objectinside a bucket, seeView object metadata.
    Note that you can only import images from.vmdk and.tar.gz files.
    diskImageTargetDefaults.targetProjectstring
    The path of theTargetProject. The target project in which youwant to create the image. For more information, seetarget project API reference.For example,
    projects/HOST_PROJECT_ID/locations/global/targetProjects/TARGET_PROJECT
    In the example, replace the following:
    • HOST_PROJECT_ID: the name of the host projectfrom which you want to migrate the virtual disk image.
    • TARGET_PROJECT: the target project in whichyou want to create the image.
    diskImageTargetDefaults.imageNamestring
    The name of the image to be created.For more information on the naming rules, seeresource naming convention.
    diskImageTargetDefaults.descriptionstring
    (Optional) A description of the image.
    diskImageTargetDefaults.familyNamestring
    (Optional) Select the image family. Compute Engine provides imagefamilies to help you make sure that your automation systems can referencethe latest images. As an administrator, you can group a set of images asan image family. For more information, seePublic image families.For more information, seePublic image families.
    diskImageTargetDefaults.labelsmap (key: string, value: string)
    To organize your project, add labels as key-value pairs to yourresources. SeeLabeling resources.
    diskImageTargetDefaults.additionalLicensesstring[]
    You can add up to 10 additional licenses to the VM instance createdfrom the imported image using a valid URL format. For example, you can addadditional licenses using the following URL format:
    https://www.googleapis.com/compute/beta/projects/windows-sql-cloud/global/licenses/sql-server-2012-enterprise
    diskImageTargetDefaults.singleRegionStorageboolean
    Set this flag to true if you want the imagestorageLocationsto be a region. If you set this flag to false, the closestmulti-region is selected.
    diskImageTargetDefaults.dataDiskImageImportboolean
    Set this flag to true if you want to skip OS adaptation.
    To function properly on Google Cloud, VMs created from imported imagesrequire changes to be made to their configuration. These changes arereferred to asOS adaptations. Migrate to Virtual Machines performs OSadaptations automatically in the image import process. For more information,seeAdapt VM instances to run on Google Cloud.
    diskImageTargetDefaults.dataDiskImageImport.guestOsFeaturesstring[]
    Use these flags to enable capabilities on your Compute Engine VM instances created from the image.
    These flags don't affect the OS of the image; it only marks the imagewith the specified features. For a list of available flags, seeGuest OS features.
    diskImageTargetDefaults.osAdaptationParameters.licenseTypestring
    The license type you want to use for your image. Compute Engine supportspay as you go (PAYG) licenses and bring your own licenses (BYOL) for yourdeployed VMs. The default license type for a migrated VM is assigned byMigrate to Virtual Machines based on the migrated operating system, as describedinSupported operating systems.
    If your operating system supports multiple license types, you can overridethe default license type to explicitly specify a license type of PAYG or BYOL.
    Note: Some operating system types, suchas CentOS and Debian, don't support a license. Other operating systems onlysupport one type of license. Attempting to set an unsupported license typecauses an error when you attempt to import the image.
    diskImageTargetDefaults.osAdaptationParameters.generalizeboolean
    Set this flag to true if you want to generalize the image.
    When you create an instance from an image, Windows adds some uniqueinformation to the instance. Generalize is a process that removes thisinformation so that you can create multiple instances from the same image.
    diskImageTargetDefaults.encryptionstring
    The Google-owned and Google-managed encryption key that you want to use to encrypt yourdata during the import process. For more information, seeencrypts data when it is at rest.
    encryptionstring
    Choose this option to use customer-managed encryption keys (CMEK) toencrypt your data during the import process, and the data of the imagecreated during the import process. If you have specific compliance orregulatory requirements related to the keys that protect your data, youcan useCMEK to encrypt and decrypt your data.These encryption keys are created, managed, and owned by you. For moreinformation, seeProtect resources by using Cloud KMS keys.
    When you add a CMEK, you must grant permissions as described in thefollowing table.
    RolePermissions requiredDescription
    Cloud VM Migration Service Accountroles/vmmigration.serviceAgentGrant this permission to the Compute Engine service account to encrypt data of the image created during the import process.
    Compute Engine Service Agentroles/compute.serviceAgentGrant this permission to the Migrate to Virtual Machines service agent to encrypt the data during the import process.

    You should see a response similar to the following sample response.

    {  "name": "projects/HOST_PROJECT_ID/locations/REGION_ID/operations/OPERATION_ID",  "metadata": {    "createTime": "2023-10-31T09:12:26.94928636Z",    "target": "projects/HOST_PROJECT_ID/locations/us-central1/imageImports/IMPORT_NAME",    "verb": "create",    "apiVersion": "v1",    "@type": "type.googleapis.com/google.cloud.vmmigration.v1.OperationMetadata"  }}
  2. Check if the image import job is complete by polling the operation usingthe following command.

    GET https://vmmigration.googleapis.com/v1/projects/HOST_PROJECT_ID/locations/REGION_ID/operations/OPERATION_ID

    Replace the following:

    • HOST_PROJECT_ID: the name of the host projectfrom which you are migrating the virtual disk image.
    • REGION_ID: the region in which you want the imageimport process to run. The image is created in the closest multi-region.If you want the image to be created in a region, make sure thatsingleRegionStorage is set to true. For a list of supportedregions, seeRegions and Zones.
    • OPERATION_ID: the operation ID of the migrate job.

    You should see an operation completion response similar to the followingsample response.

      {    "done": true,    "name": "projects/HOST_PROJECT_ID/locations/REGION_ID/operations/OPERATION_ID",    "response": {      "@type": "type.googleapis.com/google.cloud.vmmigration.v1.ImageImport",      "name": "projects/<HOST_PROJECT_ID>/locations/us-central1/imageImports/IMPORT_NAME",      "cloudStorageUri": "SOURCE_FILE",      "createTime": "2023-10-31T09:04:04.413664947Z",      "diskImageTargetDefaults": {        "imageName": "IMAGE_NAME",        "targetProject": "projects/HOST_PROJECT_ID/locations/global/targetProjects/TARGET_PROJECT"      },      "recentImageImportJobs": [        {          "name": "projects/HOST_PROJECT_ID/locations/us-central1/imageImports/IMPORT_NAME/imageImportJobs/image-import-job",          "diskImageTargetDetails": {           "imageName": "IMAGE_NAME",           "targetProject": "projects/HOST_PROJECT_ID/locations/global/targetProjects/TARGET_PROJECT"        },         "state": "PENDING"       }      ]    },    "metadata": {      "createTime": "2023-10-31T09:04:04.416740716Z",      "endTime": "2023-10-31T09:05:36.79987142Z",      "target": "projects/HOST_PROJECT_ID/locations/us-central1/imageImports/IMPORT_NAME",      "verb": "create",      "apiVersion": "v1",      "@type": "type.googleapis.com/google.cloud.vmmigration.v1.OperationMetadata"    }  }
  3. Monitor the image import job for completion using the following command.

    GET https://vmmigration.googleapis.com/v1/projects/HOST_PROJECT_ID/locations/REGION_ID/imageImports/IMPORT_NAME/imageImportJobs/image-import-job

    Replace the following:

    • HOST_PROJECT_ID: the name of the host projectfrom which you are migrating the virtual disk image.
    • REGION_ID: the region in which you want the imageimport process to run. The image is created in the closest multi-region.If you want the image to be created in a region, make sure thatsingleRegionStorage is set to true. For a list of supportedregions, seeRegions and Zones.
    • IMPORT_NAME: the ID that represents the imageimport resource. When you import an image to Compute Engine,Migrate to Virtual Machines creates an first creates an image import resource.The image import resource represents the image import process. You canuse theIMPORT_NAME to get the link to the imagethat was imported as part of the image import process.

    You should see a job completion response similar to the following sampleresponse.

    {  "createTime":"2023-10-31T09:12:27.053788394Z",  "createdResources":[    "https://www.googleapis.com/compute/v1/projects/USER_PROJECT/global/images/IMAGE_NAME"  ],  "diskImageTargetDetails": {    "imageName":"IMAGE_NAME",    "targetProject":"projects/HOST_PROJECT_ID/locations/global/targetProjects/TARGET_PROJECT"  },  "endTime":"2023-10-31T09:16:50.224865783Z",  "name":"projects/HOST_PROJECT_ID/locations/us-central1/imageImports/IMPORT_NAME/imageImportJobs/image-import-job",  "state":"SUCCEEDED"}

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-12-15 UTC.