Stay organized with collections Save and categorize content based on your preferences.
In this page, you learn how to use the Database Migration Service API to manage migration jobs for a MySQL source database.
There are two ways that you can use the Database Migration Service API. You can make REST API calls or you can use the Google Cloud CLI (CLI).
To see high-level information about using gcloud
to manage Database Migration Service migration jobs, click here.
The following shows a request to create a migration job in draft mode. This way, you don't have to create the migration job all at once. You can create a portion of it, and then update it by using the PATCH
operation.
For example, if you want to create a migration job, but you don't have the destination database or the network connectivity method, you can use the following code:
RESTBefore using any of the request data, make the following replacements:
DATABASE_PROVIDER_UNSPECIFIED
because this value is associated with an on-premises database.CLOUDSQL
.ENUM
value. See the DatabaseProvider
object reference.dump-file (optional): The dump file that you store in a bucket in Cloud Storage.
If you want to provide your own dump file, store the file in Cloud Storage, and then provide the path to it.
You can store either a zipped or unzipped dump file in a bucket in Cloud Storage.
gzip_filename.gz
. For example, gzip_dump.gz
.filename.sql
. For example, dump.sql
.flag-name and flag-value (optional): The name and value of a flag that you're adding to the mysqldump
utility. This utility creates the dump file.
You can add one or multiple flags to the dump file. For example, to add the max-allowed-packet
, ignore-error
, and add-locks
flags to the file, use the following lines of code:
"dump_flags": {"dump_flags":[ {"name": "max-allowed-packet", "value": "24MB"}, {"name": "ignore-error", "value": "12345, 34567"}, {"name": "add-locks", "value": ""}, ]}
For more information about these flags as well as other flags that you can add to your dump file, see the documentation about the mysqldump
utility in the MySQL 8.0 Reference Manual.
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id
Request JSON body:
{ "displayName": "migration-job-name", "state": "DRAFT", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/source-connection-profile-id", //"destination":"projects/project-id/locations/region/connectionProfiles/destination-connection-profile-id", "sourceDatabase": { "engine": "MYSQL", "provider": "provider" }, //"vpcPeeringConnectivity": { //"vpc": "default" //}, "dump_path": "gs://cloud-storage-bucket/dump-file" "dump_flags": {"dump_flags":[{"name": "flag-name", "value": "flag-value"}]} }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591975557292-5a7e4b195623c-e350e3da-713dee7d", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T15:25:57.430715421Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }Create a continuous migration job with VPC peering connectivity
The following shows a request to create a continuous migration job for migrating a MySQL database (running on a Google Compute Engine VM) to Cloud SQL for MySQL, using VPC peering connectivity.
RESTBefore using any of the request data, make the following replacements:
DATABASE_PROVIDER_UNSPECIFIED
because this value is associated with an on-premises database.CLOUDSQL
.ENUM
value. See the DatabaseProvider
object reference.dump-file (optional): The dump file that you store in a bucket in Cloud Storage.
If you want to provide your own dump file, store the file in Cloud Storage, and then provide the path to it.
You can store either a zipped or unzipped dump file in a bucket in Cloud Storage.
gzip_filename.gz
. For example, gzip_dump.gz
.filename.sql
. For example, dump.sql
.flag-name and flag-value (optional): The name and value of a flag that you're adding to the mysqldump
utility. This utility creates the dump file.
You can add one or multiple flags to the dump file. For example, to add the max-allowed-packet
, ignore-error
, and add-locks
flags to the file, use the following lines of code:
"dump_flags": {"dump_flags":[ {"name": "max-allowed-packet", "value": "24MB"}, {"name": "ignore-error", "value": "12345, 34567"}, {"name": "add-locks", "value": ""}, ]}
For more information about these flags as well as other flags that you can add to your dump file, see the documentation about the mysqldump
utility in the MySQL 8.0 Reference Manual.
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id
Request JSON body:
{ "displayName": "migration-job-name", "state": "NOT_STARTED", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/source-connection-profile-id", "destination":"projects/project-id/locations/region/connectionProfiles/destination-connection-profile-id", "sourceDatabase": { "engine": "MYSQL", "provider": "provider" }, "vpcPeeringConnectivity": { "vpc": "default" }, "dump_path": "gs://cloud-storage-bucket/dump-file" "dump_flags": {"dump_flags":[{"name": "flag-name", "value": "flag-value"}]} }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591975557292-5a7e4b195623c-e350e3da-713dee7d", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T15:25:57.430715421Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to create Database Migration Service migration jobs, click here.
The following shows a request to create a continuously running migration job for migrating an Amazon RDS MySQL database to Cloud SQL for MySQL, using reverse SSH connectivity.
RESTBefore using any of the request data, make the following replacements:
DATABASE_PROVIDER_UNSPECIFIED
because this value is associated with an on-premises database.CLOUDSQL
.ENUM
value. See the DatabaseProvider
object reference.dump-file (optional): The dump file that you store in a bucket in Cloud Storage.
If you want to provide your own dump file, store the file in Cloud Storage, and then provide the path to it.
You can store either a zipped or unzipped dump file in a bucket in Cloud Storage.
gzip_filename.gz
. For example, gzip_dump.gz
.filename.sql
. For example, dump.sql
.flag-name and flag-value (optional): The name and value of a flag that you're adding to the mysqldump
utility. This utility creates the dump file.
You can add one or multiple flags to the dump file. For example, to add the max-allowed-packet
, ignore-error
, and add-locks
flags to the file, use the following lines of code:
"dump_flags": {"dump_flags":[ {"name": "max-allowed-packet", "value": "24MB"}, {"name": "ignore-error", "value": "12345, 34567"}, {"name": "add-locks", "value": ""}, ]}
For more information about these flags as well as other flags that you can add to your dump file, see the documentation about the mysqldump
utility in the MySQL 8.0 Reference Manual.
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id
Request JSON body:
{ "displayName": "migration-job-name", "state": "NOT_STARTED", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/source-connection-profile-id", "destination":"projects/project-id/locations/region/connectionProfiles/destination-connection-profile-id", "sourceDatabase": { "engine": "MYSQL", "provider": "provider" }, "reverseSshConnectivity": { "vm": "vm-name", "vm_ip": "vm-ip-address", "vm_port": vm-port, "vpc": "vpc-name" }, "dump_path": "gs://cloud-storage-bucket/dump-file" "dump_flags": {"dump_flags":[{"name": "flag-name", "value": "flag-value"}]} }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to create Database Migration Service migration jobs, click here.
The following shows a request to create a migration job for migrating either a standalone MySQL instance or a managed database service to a Cloud SQL for MySQL database, using an IP allowlist.
RESTBefore using any of the request data, make the following replacements:
DATABASE_PROVIDER_UNSPECIFIED
because this value is associated with an on-premises database.CLOUDSQL
.ENUM
value. See the DatabaseProvider
object reference.dump-file (optional): The dump file that you store in a bucket in Cloud Storage.
If you want to provide your own dump file, store the file in Cloud Storage, and then provide the path to it.
You can store either a zipped or unzipped dump file in a bucket in Cloud Storage.
gzip_filename.gz
. For example, gzip_dump.gz
.filename.sql
. For example, dump.sql
.flag-name and flag-value (optional): The name and value of a flag that you're adding to the mysqldump
utility. This utility creates the dump file.
You can add one or multiple flags to the dump file. For example, to add the max-allowed-packet
, ignore-error
, and add-locks
flags to the file, use the following lines of code:
"dump_flags": {"dump_flags":[ {"name": "max-allowed-packet", "value": "24MB"}, {"name": "ignore-error", "value": "12345, 34567"}, {"name": "add-locks", "value": ""}, ]}
For more information about these flags as well as other flags that you can add to your dump file, see the documentation about the mysqldump
utility in the MySQL 8.0 Reference Manual.
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id
Request JSON body:
{ "displayName": "migration-job-name", "state": "NOT_STARTED", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/source-connection-profile-id", "destination":"projects/project-id/locations/region/connectionProfiles/destination-connection-profile-id", "sourceDatabase": { "engine": "MYSQL", "provider": "provider" }, "staticIpConnectivity": {} "dump_path": "gs://cloud-storage-bucket/dump-file" "dump_flags": {"dump_flags":[{"name": "flag-name", "value": "flag-value"}]} }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs?migrationJobId=migration-job-id" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to create Database Migration Service migration jobs, click here.
Before using any of the request data, make the following replacements:
HTTP method and URL:
GET https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X GET \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/migrationJobs/one-time-vpc-job", "createTime": "2020-06-12T15:48:39.666093835Z", "updateTime": "2020-06-12T15:48:39.666093835Z", "displayName": "migration-job-display-name", "state": "CREATING", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "destination": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "sourceDatabase": { "engine": "MYSQL" }, "destinationDatabase": { "provider": "CLOUDSQL" }, "vpcPeeringConnectivity": { "vpc": "default" } }gcloud
For more information on using gcloud
to retrieve information about your migration job, click here.
Before using any of the request data, make the following replacements:
orderBy:
Use this filter to retrieve a listing of all migration jobs for a particular region in alphabetical order. For example, the orderBy=name
filter returns all migration jobs, alphabetically, by name.pageSize:
Use this filter to specify the maximum number of migration jobs that Database Migration Service retrieves and displays on a page. For example, by setting pageSize=10
, Database Migration Service will return up to 10 migration jobs for a page.
If there are more than 10 migration jobs, then they appear on other pages. At the end of each page, a nextPageToken
parameter and a unique identifier appear (for example, oasndfoasdnoasun1241243ojsandf
). Use the identifier to retrieve the listing of the migration jobs for the following page. On the final page, the nextPageToken
parameter and unique identifier don't appear.
HTTP method and URL:
GET https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X GET \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "migrationJobs": [ { "name": "projects/project-id/locations/region/migrationJobs/name-of-first-migration-job", "createTime": "2020-06-12T15:48:39.666093835Z", "updateTime": "2020-06-12T15:48:39.666093835Z", "displayName": "display-name-of-first-migration-job", "state": "NOT_STARTED", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "destination": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "sourceDatabase": { "engine": "MYSQL" }, "destinationDatabase": { "provider": "CLOUDSQL" }, "vpcPeeringConnectivity": { "vpc": "default" } } { "name": "projects/project-id/locations/region/migrationJobs/name-of-second-migration-job", "createTime": "2021-02-13T11:59:39.104613835Z", "updateTime": "2021-02-13T12:01:38.666093835Z", "displayName": "display-name-of-second-migration-job", "state": "RUNNING", "type": "CONTINUOUS", "source": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "destination": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "sourceDatabase": { "engine": "MYSQL" }, "destinationDatabase": { "provider": "CLOUDSQL" }, "staticIpConnectivity": {} "vpc": "default" } ], "nextPageToken": "unique-identifier" }gcloud
For more information on using gcloud
to retrieve information about all of your migration jobs, click here.
Before using any of the request data, make the following replacements:
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:generateSshScript
Request JSON body:
{ "vm":"vm-name", "vmCreationConfig":{ "vmMachineType":"machine-type", "subnet":"subnet-name" } }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:generateSshScript"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:generateSshScript" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "generate", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to generate an SSH script for your migration job, click here.
The following shows a request to verify a migration job. By verifying a migration job, you can ensure that the job will start and run successfully.
RESTBefore using any of the request data, make the following replacements:
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:verify
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:verify"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:verify" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "verify", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to verify your migration job, click here.
The following shows a request to update the display name of an existing migration job. By using the updateMask
parameter in the request, only these fields need to be included in the request body.
Before using any of the request data, make the following replacements:
HTTP method and URL:
PATCH https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id?updateMask=displayName
Request JSON body:
{ "displayName": "updated-display-name", }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X PATCH \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id?updateMask=displayName"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id?updateMask=displayName" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "update", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to update your migration job, click here.
The following shows a request to start a migration job.
RESTBefore using any of the request data, make the following replacements:
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:start
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:start"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:start" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "start", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to start your migration job, click here.
The following shows a request to restart a migration job. A migration job can be restarted from the beginning if the migration failed and is not recoverable, or was stopped during full dump.
RESTBefore using any of the request data, make the following replacements:
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:restart
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:restart"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:restart" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "restart", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to restart your migration job, click here.
The following shows a request to stop a migration job.
RESTBefore using any of the request data, make the following replacements:
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:stop
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:stop"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:stop" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "stop", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to stop your migration job, click here.
The following shows a request to resume a migration job.
RESTBefore using any of the request data, make the following replacements:
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:resume
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X POST \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:resume"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id:resume" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "resume", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to resume your migration job, click here.
The following shows a request to promote a migration job.
Delete a migration jobThe following shows a request to delete a migration job.
RESTBefore using any of the request data, make the following replacements:
HTTP method and URL:
DELETE https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X DELETE \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/migrationJobs/migration-job-id", "verb": "delete", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }gcloud
For more information on using gcloud
to delete your migration job, click here.
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 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This document details how to use the Database Migration Service API for managing migration jobs specifically for MySQL source databases, including using REST API calls or the Google Cloud CLI (CLI)."],["Migration jobs can be created in a draft mode, allowing partial creation and subsequent updates via the `PATCH` operation, which is useful when destination database details or network connectivity methods are not immediately available."],["The API supports creating different types of continuous migration jobs, such as those using VPC peering, reverse SSH connectivity, or IP allowlists, each with specific setup requirements and parameters."],["Users can perform various operations on migration jobs, including creating, retrieving, listing, updating, verifying, starting, restarting, stopping, resuming, promoting, generating an SSH script, and deleting them."],["The document also provides detailed instructions and code examples for sending requests via `curl` (for Linux, macOS, or Cloud Shell) and PowerShell (for Windows), as well as information on using `gcloud` commands for database migration job management."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4