gcloud database-migration migration-jobs generate-ssh-script

NAME
gcloud database-migration migration-jobs generate-ssh-script - generate a SSH script for a Database Migration Service migration job
SYNOPSIS
gcloud database-migration migration-jobs generate-ssh-script(MIGRATION_JOB :--region=REGION)--vm=VM(--vm-zone=VM_ZONE    | [--subnet=SUBNET--vm-machine-type=VM_MACHINE_TYPE :--vm-zone-create=VM_ZONE_CREATE])[--vm-port=VM_PORT][GCLOUD_WIDE_FLAG]
DESCRIPTION
Generate a script for a Database Migration Service migration job, to configureReverse SSH tunnel connectivity with a bastion host on a Compute Engine VMinstance. You can use an existing VM instance or create a new VM for thispurpose.

Copy the generated script and run it in bash from a machine that has:

  • The gcloud command-line tool installed.
  • Access to your source database.
  • Access to the existing bastion VM, or permissions and access to the CloudCompute API if creating a new bastion VM. Make sure this machine is availableduring the entire migration.

Running the script will set up the SSH tunnel on the VM you selected and willestablish connectivity between the source database and the Cloud SQL instance.Find additional informationhere.

EXAMPLES
To generate an SSH script with bastion VM instance creation:
gclouddatabase-migrationmigration-jobsgenerate-ssh-scriptmy-migration-job--vm=vm1--vm-port=1111--vm-machine-type=n1-standard-1--vm-zone-create=us-central1-a--subnet=sample-subnet--region=us-central1

To generate an SSH script with an existing bastion VM instance:

gclouddatabase-migrationmigration-jobsgenerate-ssh-scriptmy-migration-job--vm=vm1--vm-port=1111--vm-zone=us-central1-a--region=us-central1
POSITIONAL ARGUMENTS
Migration job resource - The migration job to generate the SSH script for. Thearguments in this group can be used to specify the attributes of this resource.(NOTE) Some attributes are not given arguments in this group but can be set inother ways.

To set theproject attribute:

  • provide the argumentmigration_job on the command line with a fullyspecified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

MIGRATION_JOB
ID of the migration_job or fully qualified identifier for the migration_job.

To set themigration_job attribute:

  • provide the argumentmigration_job on the command line.

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

--region=REGION
The name of the region.

To set theregion attribute:

  • provide the argumentmigration_job on the command line with a fullyspecified name;
  • provide the argument--region on the command line.
REQUIRED FLAGS
--vm=VM
Bastion Compute Engine VM instance name to use or to create.
Exactly one of these must be specified:
--vm-zone=VM_ZONE
Zone the existing bastion VM instance is located in.
--subnet=SUBNET
Subnet to create the VM instance in.

This flag argument must be specified if any of the other arguments in this groupare specified.

--vm-machine-type=VM_MACHINE_TYPE
Machine type for a new VM instance. To get a list of available machine types,run 'gcloud compute machine-types list'.

This flag argument must be specified if any of the other arguments in this groupare specified.

--vm-zone-create=VM_ZONE_CREATE
Zone to create the VM instance in.
OPTIONAL FLAGS
--vm-port=VM_PORT
Port that will be open on the bastion host.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

API REFERENCE
This command uses thedatamigration/v1 API. The full documentationfor this API can be found at:https://cloud.google.com/database-migration/
NOTES
This variant is also available:
gcloudalphadatabase-migrationmigration-jobsgenerate-ssh-script

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

Last updated 2025-05-07 UTC.