A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/database-migration/docs/mysql/api-migration-jobs below:

Manage migration jobs using the API | Database Migration Service

Skip to main content Manage migration jobs using the API

Stay organized with collections Save and categorize content based on your preferences.


Overview

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.

Note: Some API calls for Database Migration Service can take some time to complete. Because the API is asynchronous, the call returns immediately, even if the operation is still in progress. If a subsequent API call uses a newly created object, then you must wait for the first operation to complete before proceeding. Create a draft of a migration job

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:

REST

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?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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

REST

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?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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Create a continuous migration job with reverse SSH connectivity

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.

REST

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?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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Create a migration job with IP allowlist connectivity

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.

REST

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?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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Get information about a migration job REST

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 the gcloud 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 \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

List migration jobs REST

Before using any of the request data, make the following replacements:

You can also filter the list of migration jobs that Database Migration Service retrieves, as follows:

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 the gcloud 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 \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Generate an SSH tunnel configuration script for a migration job REST

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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Verify a migration job

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.

REST

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: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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Update a migration job

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.

REST

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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Start a migration job

The following shows a request to start a migration job.

REST

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: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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Restart a failed migration job

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.

REST

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: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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Stop a migration job

The following shows a request to stop a migration job.

REST

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: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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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.

Resume a migration job

The following shows a request to resume a migration job.

REST

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: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 the gcloud 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 \
-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"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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 job

The following shows a request to delete a migration job.

REST

Before 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 the gcloud 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 \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://datamigration.googleapis.com/v1/projects/project-id/locations/region/migrationJobs/migration-job-id"
PowerShell (Windows) Note: The following command assumes that you have logged in to the 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