Migrate disks Stay organized with collections Save and categorize content based on your preferences.
Preview
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
Migrate to Virtual Machines lets you migrate unattached disks from anAWS source to Persistent Disk volumes on Google Cloud. This feature is usefulwhen you want to migrate your unattached disks, that is, disks that are notconnected to any virtual machine (VM) instance to Google Cloud.
For unattached disks, Migrate to Virtual Machines doesn't perform replication cyclesbecause the disks are not active, as they are not connected to a VM. The data inthe disk is copied in a one-time operation.
Before you begin
Before you begin the migration process, do the following:
- Enable Migrate to Virtual Machines servicesto configure the migration environment on yourmigration source andmigration target.
- Create an AWS IAM policy for
ec2:CreateSnapshotby ensuring that you addec2:CreateSnapshotto the referencedpolicy.
Limitations
The following limitations apply:
- You can only migrate disks from AWS sources.
- You can only use REST APIs to migrate the disks.
- Regional disks and hyperdisk disks are not supported.
Disk migration process
To migrate unattached disks to Google Cloud, use the following steps:
In the Cloud Shell terminal, define a convenient shell alias for callingGoogle REST APIs:
alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
Create a disk migration job using the following REST command:
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/?disk_migration_job_id=DISK_MIGRATION_JOB -X POST --data '{ "aws_source_disk_details":{"volume_id":"AWS_VOLUME_ID"}, "target_details":{ "target_disk":{ "disk_id":"TARGET_DISK_ID", "zone":"TARGET_ZONE", "disk_type":"DISK_TYPE" }, "target_project":"projects/HOST_PROJECT/locations/global/targetProjects/TARGET_PROJECT", "labels":{CUSTOM_LABELS}, "encryption":{"kms_key":"KMS_KEY"} }}'Replace the following:
HOST_PROJECT: the name of the host project fromwhich you want to migrate the disks.LOCATION: the zone in which you want the diskmigration process to run. For a list of supported zones, seeRegions and Zones.M2VM_SOURCE: the cloud source from which you wantto migrate the disks. Note that you can only migrate disks from AWS sourcesin the Preview stage.DISK_MIGRATION_JOB: the ID of the disk migrationjob. For information on naming convention for Compute Engine resources,seeNaming conventions.AWS_VOLUME_ID: the names of the disks that you wantto migrate.TARGET_DISK_ID: the ID of the target disk. Forinformation on naming convention for Compute Engine resources,seeNaming conventions.TARGET_PROJECT: the ID of the target project towhich you want to migrate the disks. If you've not already added a targetproject, do so using the instructions given inAdd a target project.TARGET_ZONE: zone of the target project. See Regions and Zones.DISK_TYPE: thetype of persistent disk that you want tomigrate your disks to. Migrate to Virtual Machines supports the following disktypes:COMPUTE_ENGINE_DISK_TYPE_STANDARD: a Standard disk type.COMPUTE_ENGINE_DISK_TYPE_SSD: a SSD hard disk type.COMPUTE_ENGINE_DISK_TYPE_BALANCED: an alternative to SSDpersistent disks that balance performance and cost.COMPUTE_ENGINE_DISK_TYPE_HYPERDISK_BALANCED: hyperdiskbalanced disk type.
- (Optional)
CUSTOM_LABELS: any labels you want togive the migrated disk. For example,"key1":"val1", "key2":"val2". - (Optional)
KMS_KEY: the KMS key you want to use forthe migrated disk. For more information, seeCloud Key Management Service overview.
(Optional) Update the target details. The target project is the project thatcontains the migrated disk. You can configure the target details includingproject, zone, and disk type based on your preferences. You can modify thetarget details at any time. You can use the command given in the previousstep to update the target details as well.
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB\?update_mask\=target_details -X PATCH --data '{ "target_details":{ "target_disk":{ "disk_id":"TARGET_DISK_ID", "zone":"TARGET_ZONE", "disk_type":"DISK_TYPE" }, "target_project":"projects/HOST_PROJECT/locations/global/targetProjects/TARGET_PROJECT", "labels":{CUSTOM_LABELS}, "encryption":{"kms_key":"KMS_KEY"} }}'Run the migration job using the following REST command:
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB:run -X POST
Poll the job to check its status using the following REST command:
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB
Supported REST API operations for single disk migrations
Migrate to Virtual Machines supports the following REST API operations to migrate asingle disk:
Create a disk migration job
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/?disk_migration_job_id=DISK_MIGRATION_JOB -X POST --data '{ "aws_source_disk_details":{"volume_id":"AWS_VOLUME_ID"}, "target_details":{ "target_disk":{ "disk_id":"TARGET_DISK_ID", "zone":"TARGET_ZONE", "disk_type":"DISK_TYPE" }, "target_project":"projects/HOST_PROJECT/locations/global/targetProjects/TARGET_PROJECT", "labels":{CUSTOM_LABELS}, "encryption":{"kms_key":"KMS_KEY"} }}'Replace the following:
HOST_PROJECT: the name of the host project fromwhich you want to migrate the disks.LOCATION: the zone in which you want the diskmigration process to run. For a list of supported zones, seeRegions and Zones.M2VM_SOURCE: the cloud source from which you wantto migrate the disks. Note that you can only migrate disks from AWS sourcesin the Preview stage.DISK_MIGRATION_JOB: the ID of the disk migrationjob. For information on naming convention for Compute Engine resources,seeNaming conventions.AWS_VOLUME_ID: the names of the disks that you want tomigrate.TARGET_DISK_ID: the ID of the target disk. Forinformation on naming convention for Compute Engine resources, seeNaming conventions.TARGET_PROJECT: the ID of the target project towhich you want to migrate the disks. If you've not already added a targetproject, do so using the instructions given inAdd a target project.TARGET_ZONE: zone of the target project. See Regions and Zones.DISK_TYPE: thetype of persistent disk that you want tomigrate your disks to. Migrate to Virtual Machines supports the following disktypes:COMPUTE_ENGINE_DISK_TYPE_STANDARD: a Standard disk type.COMPUTE_ENGINE_DISK_TYPE_SSD: a SSD hard disk type.COMPUTE_ENGINE_DISK_TYPE_BALANCED: an alternative to SSDpersistent disks that balance performance and cost.COMPUTE_ENGINE_DISK_TYPE_HYPERDISK_BALANCED: hyperdisk balanceddisk type.
- (Optional)
CUSTOM_LABELS: any labels you want to givethe migrated disk. For example,"key1":"val1", "key2":"val2". - (Optional)
KMS_KEY: the KMS key you want to use forthe migrated disk. For more information, seeCloud Key Management Service overview.
Update a disk migration job
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB\?update_mask\=target_details -X PATCH --data '{ "target_details":{ "target_disk":{ "disk_id":"TARGET_DISK_ID", "zone":"TARGET_ZONE", "disk_type":"DISK_TYPE" }, "target_project":"projects/HOST_PROJECT/locations/global/targetProjects/TARGET_PROJECT", "labels":{CUSTOM_LABELS}, "encryption":{"kms_key":"KMS_KEY"} }}'Get a disk migration job
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB
List disk migration jobs
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs
Run a disk migration job
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB:run -X POST
Cancel a disk migration job
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB:cancel -X POST
Delete a disk migration job
gcurl https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/DISK_MIGRATION_JOB -X DELETE
REST API scripts for batch disk migrations
Use the following the REST API scripts to perform batch disk migration tasks.
Create a batch disk migration job
token=`gcloud auth print-access-token`for PAIR in `echo "SRC_TARGET_PAIRS" |tr -d ' '|tr ',' ' '`;do vol=${PAIR%:*} disk=${PAIR#*:} curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs\?disk_migration_job_id\=dmj-${vol} -X POST -d '{ "aws_source_disk_details":{"volume_id":"'${vol}'"}, "target_details":{ "target_disk":{ "disk_id":"'${disk}'", "zone":"TARGET_ZONE", "disk_type":"DISK_TYPE" }, "target_project":"projects/HOST_PROJECT/locations/global/targetProjects/TARGET_PROJECT", "labels":{CUSTOM_LABELS}, "encryption":{"kms_key":"KMS_KEY"} } }'doneReplace the following:
SRC_TARGET_PAIRS: a comma-separated list ofSOURCE:TARGETpairs. For example,vol1:disk1, vol2:disk2.HOST_PROJECT: the name of the host project fromwhich you want to migrate the disks.LOCATION: the zone in which you want the diskmigration process to run. For a list of supported zones, seeRegions and Zones.M2VM_SOURCE: the cloud source from which you wantto migrate the disks. Note that you can only migrate disks from AWS sourcesin the Preview stage.DISK_MIGRATION_JOB: the ID of the disk migrationjob. For information on naming convention for Compute Engine resources,seeNaming conventions.AWS_VOLUME_ID: the names of the disks that you want tomigrate.TARGET_DISK_ID: the ID of the target disk. Forinformation on naming convention for Compute Engine resources, seeNaming conventions.TARGET_PROJECT: the ID of the target project towhich you want to migrate the disks. If you've not already added a targetproject, do so using the instructions given inAdd a target project.TARGET_ZONE: zone of the target project. See Regions and Zones.DISK_TYPE: thetype of persistent disk that you want tomigrate your disks to. Migrate to Virtual Machines supports the following disktypes:COMPUTE_ENGINE_DISK_TYPE_STANDARD: a Standard disk type.COMPUTE_ENGINE_DISK_TYPE_SSD: a SSD hard disk type.COMPUTE_ENGINE_DISK_TYPE_BALANCED: an alternative to SSDpersistent disks that balance performance and cost.COMPUTE_ENGINE_DISK_TYPE_HYPERDISK_BALANCED: hyperdisk balanceddisk type.
CUSTOM_LABELS: any labels you want to give themigrated disk. For example,"key1":"val1", "key2":"val2".KMS_KEY: the KMS key you want to use for the migrateddisk. For more information, seeCloud Key Management Service overview.
Update a batch disk migration job
token=`gcloud auth print-access-token`for PAIR in `echo "SRC_TARGET_PAIRS" |tr -d ' '|tr ',' ' '`;do vol=${PAIR%:*} disk=${PAIR#*:} curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/dmj-${vol}\?update_mask\=target_details -X PATCH -d '{ "target_details":{ "target_disk":{ "disk_id":"'${disk}'", "zone":"TARGET_ZONE", "disk_type":"DISK_TYPE" }, "target_project":"projects/HOST_PROJECT/locations/global/targetProjects/TARGET_PROJECT", "labels":{CUSTOM_LABELS}, "encryption":{"kms_key":"KMS_KEY"} } }'doneGet a batch disk migration job
token=`gcloud auth print-access-token`for PAIR in `echo "SRC_TARGET_PAIRS" |tr -d ' '|tr ',' ' '`;do vol=${PAIR%:*} disk=${PAIR#*:} curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/dmj-${vol};doneList batch disk migration jobs
token=`gcloud auth print-access-token` curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs
Run a batch disk migration job
token=`gcloud auth print-access-token`for PAIR in `echo "SRC_TARGET_PAIRS" |tr -d ' '|tr ',' ' '`;do vol=${PAIR%:*} disk=${PAIR#*:} curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/dmj-${vol}:run -X POST;doneCancel a batch disk migration job
token=`gcloud auth print-access-token`for PAIR in `echo "SRC_TARGET_PAIRS" |tr -d ' '|tr ',' ' '`;do vol=${PAIR%:*} disk=${PAIR#*:} curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/dmj-${vol}:cancel -X POST;doneDelete a batch disk migration job
token=`gcloud auth print-access-token`for PAIR in `echo "SRC_TARGET_PAIRS" |tr -d ' '|tr ',' ' '`;do vol=${PAIR%:*} disk=${PAIR#*:} curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" https://vmmigration.googleapis.com/v1alpha1/projects/HOST_PROJECT/locations/LOCATION/sources/M2VM_SOURCE/diskMigrationJobs/dmj-${vol} -X DELETE;doneExcept 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.