A RetroSearch Logo

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

Search Query:

Showing content from https://cloud.google.com/database-migration/docs/mysql/configure-connectivity-reverse-ssh-tunnel below:

Configure connectivity using reverse SSH tunnel | Database Migration Service

Skip to main content Configure connectivity using reverse SSH tunnel

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


Overview

You can establish connectivity from the destination database to the source database through a secure reverse SSH tunnel. This method requires a bastion host VM in the Google Cloud project as well as a machine (for example, a laptop on the network) that has connectivity to the source database.

Important: If your source is within a VPN (in AWS, for example, or your own on-premises VPN), your source connection profile should use the VPN IP address and port instead of the source IP address and port.

The Database Migration Service for MySQL collects the required information at migration creation time, and auto-generates the script for setting it all up.

See the following diagram:

Set up a reverse SSH tunnel

The following steps are performed in the Database Migration Service flow for creating a migration job, to set up a reverse SSH tunnel between the source database and Cloud SQL instance. After you provide some parameters, you execute a set of gcloud commands on a machine which has connectivity to both the source database and to Google Cloud.

  1. Select the VM instance used to establish connectivity between the source database and the Cloud SQL instance. Typically this is a VM running in the VPC where the application accessing the new Cloud SQL database runs. The VM instance serves as the SSH tunnel bastion server.
  2. You can use an existing Compute Engine VM instance for this purpose.

    1. Choose the Compute Engine VM instance from the list.

    2. Provide a free port that the SSH tunnel can use.

    Note: For the reverse SSH tunnel to work, set the `GatewayPorts` parameter to `yes` in the /etc/ssh/sshd_config file on the target server. After you update the file, restart the sshd service using the sudo systemctl restart sshd.service command.

    If you don't want to change the configuration of your existing VM, then create a new VM.

  3. Alternatively, you can create a new VM at this step. Select CREATE A COMPUTE ENGINE VM INSTANCE and the generated script includes instructions to create it.

    1. Provide a name for the VM instance.

    2. Select a machine type for the VM.

    3. Specify a subnet for the VM

    Note: A Compute Engine VM instance created by the script isn't managed by Database Migration Service. If one is created, then your organization is charged for the instance based on standard pricing, and is responsible for its management, including deleting the instance when it's no longer needed.
  4. Click VIEW SCRIPT to view the generated script.

    By default, the script will generate a public IP address for the Compute Engine VM server. If you want the IP address to be private, then do the following:

    Also, if you want to create a bastion host VM on a subnet which is on a shared VPC, then alter the export SUBNET_NAME command from the generated script to point to /projects/project_name/regions/region_name/subnetworks/subnetwork_name.

    For example:

    export SUBNET_NAME=projects/myproject/regions/myregion/subnetworks/mysubnetwork

    project_name is the name of the project where the shared VPC is placed. A project has regions and subnetworks. region_name and subnetwork_name are the names of the region and subnetwork that are associated with the VPC project.

  5. Run the script on a machine that has access to both the source database and the Compute Engine VM. The script performs the following operations:

  6. Click CONFIGURE & CONTINUE.

  7. Verify your migration job to confirm that it correctly migrated data from your source database instance to the destination Cloud SQL database instance.

  8. If your source is within a VPN (in AWS, for example, or your own on-premises VPN), proceed to the section on connecting VPCs through VPNs for more information on configuring the source VPN and Google Cloud VPN to work with each other.

  9. After your migration job is configured, connectivity is verified, and VPNs are configured successfully if necessary, then you can run the job.

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-07-09 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-07-09 UTC."],[[["A secure reverse SSH tunnel can be established to connect the destination database to the source database, requiring a bastion host VM in Google Cloud and a machine with source database connectivity."],["The Database Migration Service for MySQL automatically generates a script to set up the reverse SSH tunnel during migration creation."],["Users can either utilize an existing Compute Engine VM instance or create a new one as the SSH tunnel bastion server, ensuring `GatewayPorts` is set to `yes` and restarting the sshd service on the target server."],["The generated script can be modified to create a VM with a private IP address or to use a subnet within a shared VPC, providing flexibility in network configurations."],["The generated script needs to be executed on a machine with access to both the source database and the Compute Engine VM, and it configures the VM as an SSH tunnel bastion server to establish a secure SSH connection."]]],[]]


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