To move data from your source database server into the destination
AlloyDB for PostgreSQL instance, Database Migration Service needs to connect to your source
instance. That connection can be established over the public internet,
or through a series of private connections in your project's
Virtual Private Cloud (VPC).

This page provides an overview of each available source database connectivity
method, as well as a recommendation section to help you choose
the right solution for your migration:

- [Method comparison](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#methods-comparison) provides a comparison table for available source
  connectivity methods.

- [IP allowlist](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#ip-allowlist) describes network connectivity to the public IP
  of your source database.

- [Forward-SSH tunnel](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#forward-ssh-tunnel) provides an overview for dedicated Secure Shell
  (SSH) tunnels.

- [Private connectivity with Private Service Connect interfaces](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity-psci)
  describes how to connect to your source private IP with network attachments.

- [Private connectivity with VPC peering](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity) describes how you can establish
  a connection to the private IP of your source database over peered VPC networks.

After you familiarize yourself with different connectivity methods and their
requirements, you can use the
[decision tree diagram](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#decision-tree) to pick the right solution for your scenario.

## Method comparison

Every source connectivity method comes with different benefits and requirements.
Use the following table to compare them at a glance, and then learn more
details in the sections dedicated for each method.

| Networking method | Advantages | Disadvantages |
|---|---|---|
| [IP allowlist](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#ip-allowlist) | - The easiest connectivity method to set up. - Useful when your source database can't be reached through private networks in Google Cloud. | - Requires that you expose an IPv4 address of your source database server to the public internet. This requires extra security measures. For example, we recommend that you use TLS certificates and firewall rules for securing the connection. - Configuring the firewall rules may require assistance from the IT department. |
| [Forward SSH tunnel](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#forward-ssh-tunnel) | - More secure than connecting over public IP with an IP allowlist. The initial connection is established through Secure Shell (SSH) ports over the public internet. Once the connection is active, all traffic travels over a secure, private connection. - Useful when your source database can't be reached through private networks in Google Cloud, but you don't want to expose your source database server directly to the public internet. | - Using an intermediate server (the forward-SSH tunnel machine) for connectivity might introduce additional latency. - You must set up and maintain the forward-ssh host server. The server must be online for the whole duration of your migration. |
| [Private Service Connect interfaces](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity-psci) | - Establishes connections to your source private IP by using a network attachment. This method doesn't consume peering quota in your VPC. - The easiest source private connectivity method to configure. | - Requires setting up a network attachment and adjusting firewall rules. - You can't modify the network attachment after you establish the connection. |
| [Private connectivity with Virtual Private Cloud peering](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity) | The connection is established to the private IP address of your source database over VPC peerings. If your VPC doesn't have enough peering quota, it might be difficult to use this connectivity method. In most cases, we recommend that you use [Private connectivity with Private Service Connect interfaces](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity-psci) instead. | - For sources outside your Google Cloud VPC, you might need to use additional network components, such as Cloud VPN a reverse proxy VM. - You need a [Virtual Private Cloud with private services access enabled](https://docs.cloud.google.com/vpc/docs/configure-private-services-access.md.txt) to use Virtual Private Cloud peering. - This setup consumes [peering quota](https://docs.cloud.google.com/vpc/docs/vpc-peering.md.txt#peering-limits) on your VPC network. |

## IP allowlist for source database connectivity

When you use the IP allowlist connectivity method, Database Migration Service attempts
to establish a connection to a publicly available IP address of your source
database server.
[![A networking diagram that shows a high-level public IP connectivity
setup.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_public_ip_src.svg)](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source#lightbox-trigger) **Figure 1.** Migration networking example: public IP source connectivity. (click to enlarge) ![A networking diagram that shows a high-level public IP connectivity
setup.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_public_ip_src.svg)

### Requirements for IP allowlist connectivity

At a high level, to use this connectivity method you need to ensure the following:

- You must expose your source's IP address to the public internet
  (either directly, or with a publicly recognized hostname through a
  *Domain Name Server* (DNS)).

- You need to allow incoming connections from
  [Database Migration Service public IP addresses](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/ip-allowlists-and-regions.md.txt).

- Optional: IP allowlist connectivity uses unencrypted connections by default.
  We recommend that you use TLS certificates to secure your connection.
  Database Migration Service offers support for different TLS types so that you can
  pick the best solution depending on what your source database can support.
  For more information, see
  [Use SSL/TLS certificates to encrypt network connections](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/encrypt-connections-with-certificates.md.txt).

### Configure IP allowlist connectivity

Configuring public IP connectivity requires different steps depending on
you source database type. For more information, see:

- [Configure IP allowlist connectivity for self-hosted sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-self-hosted.md.txt#ip-allowlist)

- [Configure IP allowlist connectivity for Cloud SQL for SQL Server sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-csql-sqlserver.md.txt#ip-allowlist)

- [Configure IP allowlist connectivity for sources in Amazon Web Services](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-aws-rds-sqlserver.md.txt#ip-allowlist)

- [Configure IP allowlist connectivity for sources in Microsoft Azure](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-azure-sqlserver.md.txt#ip-allowlist)

## Forward-SSH tunnel for source database connectivity

This connectivity method is a mixture of public and private network connectivity.
The connection itself is established through *Secure Shell* (SSH) ports
to the public IP address of the tunnel host server.
Once the connection is active, all traffic travels over a secure tunnel
to the private IP address of your source database.
[![A networking diagram that shows a high-level connectivity
setup over a dedicated SSH tunnel server.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_ssh_tunnel_src.svg)](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source#lightbox-trigger) **Figure 2.** Migration networking example: source connectivity over an SSH tunnel. (click to enlarge) ![A networking diagram that shows a high-level connectivity
setup over a dedicated SSH tunnel server.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_ssh_tunnel_src.svg)

### Requirements for forward-SSH tunnels

To create the connection, you need to expose SSH ports to the
public internet on your tunnel server. When connectivity is established,
all traffic is routed through the private tunnel connection.

It's possible to terminate the tunnel on the same server where you host your
source database, but we recommend that you use a dedicated tunnel server.
This way you aren't exposing your source database directly to the public
internet. The tunnel server can be any Unix/Linux host that can be reached
from the internet via SSH, and can access your source database.

For certain connectivity scenarios, we recommend that you use the
[private connectivity with Virtual Private Cloud peering](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity) networking method
instead of a forward-SSH tunnel:

- For self-hosted sources that reside inside inside Google Cloud,
  Database Migration Service can access the private IP of your source
  database with the private connectivity configuration. You don't need to set up
  a separate SSH server to establish the connection.

- For Cloud SQL for SQL Server sources, you also don't need to use an SSH tunnel to establish
  a connection to the private IP of your database. But you need
  [a reverse proxy VM](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-reverse-proxy.md.txt) because of the *transitive peering* limitation.

### Configure forward-SSH tunnel connectivity

Configuring connectivity through a forward-SSH tunnel requires different steps
depending on you source database type. For more information, see:

- [Configure connectivity over a forward-SSH tunnel for self-hosted sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-self-hosted.md.txt#forward-ssh)

- [Configure IP allowlist connectivity for sources in Amazon Web Services](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-aws-rds-sqlserver.md.txt#forward-ssh)

- [Configure IP allowlist connectivity for sources in Microsoft Azure](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-azure-sqlserver.md.txt#forward-ssh)

## Private connectivity with Private Service Connect interfaces

[Private Service Connect interfaces](https://docs.cloud.google.com/vpc/docs/about-private-service-connect-interfaces.md.txt) let Database Migration Service initiate connections to the private IP of your source database without consuming peering quota for its own IP addresses. Instead, this connectivity method utilizes network attachments you create in your VPC.

<br />

[![A networking diagram that shows a high-level connectivity
setup with a VPC peering and a Cloud SQL for SQL Server source database.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_psci_csql_source.svg)](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source#lightbox-trigger) **Figure 3.** Migration networking example: private IP source connectivity with Private Service Connect interfaces for a Cloud SQL for SQL Server source. (click to enlarge) ![A networking diagram that shows a high-level connectivity
setup with a VPC peering and a Cloud SQL for SQL Server source database.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_psci_csql_source.svg)

<br />

[![A networking diagram that shows a high-level connectivity
setup over a dedicated SSH tunnel server and Private Service
Connect interfaces..](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_psci_3rd_party_cloud_source.svg)](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source#lightbox-trigger) **Figure 4.** Migration networking example: private IP source connectivity with Private Service Connect interfaces and Cloud VPN for sources that reside in other cloud offerings. (click to enlarge) ![A networking diagram that shows a high-level connectivity
setup over a dedicated SSH tunnel server and Private Service
Connect interfaces.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_psci_3rd_party_cloud_source.svg)

### Requirements for Private Service Connect interfaces

This connectivity method requires that you create a network attachment in the
VPC network where your source database can be reached. The subnet for the network
attachment must have 6 usable IP addresses (meaning, you have to use the
`/29` range for a total of 8 IP addresses). You can use the same network
attachment for multiple migration jobs, provided that you have at least one
available IP address for your AlloyDB for PostgreSQL cluster
(AlloyDB for PostgreSQL only supports Private Service Connect interfaces
for the primary cluster).

### Configure private IP connectivity with Private Service Connect interfaces

To use private IP connectivity with Private Service Connect interfaces,
your source database private IP must be reachable from the Virtual Private Cloud
where you create the network attachment.
To learn more about configuring this private IP connectivity method for different
database sources, see:

- For self-hosted sources: See
  [Configure private IP connectivity with Private Service Connect interfaces for self-hosted
  sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-self-hosted#private-psc-interfaces).

- For Cloud SQL for SQL Server sources: See
  [Configure private IP connectivity with Private Service Connect interfaces
  for Cloud SQL for SQL Server sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-csql-sqlserver#private-vpc-peering).

- For Microsoft Azure and Amazon RDS sources: You need Cloud VPN or
  Cloud Interconnect to create the connection to the private IP of your source
  database. See:

  - [Configure private IP connectivity with Private Service Connect interfaces
    for Microsoft Azure sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-azure-sqlserver#private-vpc-peering).

  - [Configure private IP connectivity with Private Service Connect interfaces
    for Amazon RDS sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-aws-rds-sqlserver#private-psc-interfaces).

## Private connectivity with VPC peering

> [!IMPORTANT]
> **Important:** Database Migration Service uses peering to connect to the VPC where your source database can be reached. If your VPC doesn't have enough peering quota, it might be difficult to use this connectivity method. In most cases, we recommend that you use [Private connectivity with Private Service Connect interfaces](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source.md.txt#private-connectivity-psci) instead.

This method lets you connect to your source through the private IP addresses
in your Virtual Private Cloud (VPC). You don't need to expose any interfaces to the public
internet to use this method, but it requires that your source database IP
address or hostname can be reached from your Google Cloud VPC.

Depending on what source database you have, this connectivity method might
require you to set up additional network components (such as Cloud VPN
or a reverse proxy VM):
[![A networking diagram that shows a high-level connectivity
setup with a VPC peering and a Cloud SQL for SQL Server source database.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_vpc_csql_source.svg)](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source#lightbox-trigger) **Figure 5.** Migration networking example: private IP source connectivity with Virtual Private Cloud peering for a Cloud SQL for SQL Server source. (click to enlarge) ![A networking diagram that shows a high-level connectivity
setup with a VPC peering and a Cloud SQL for SQL Server source database.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_vpc_csql_source.svg)

<br />

[![A networking diagram that shows a high-level connectivity
setup over a dedicated SSH tunnel server.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_vpc_3rd_party_cloud_source.svg)](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-source#lightbox-trigger) **Figure 6.** Migration networking example: private IP source connectivity with Virtual Private Cloud peering and Cloud VPN for sources that reside in other cloud offerings. (click to enlarge) ![A networking diagram that shows a high-level connectivity
setup over a dedicated SSH tunnel server.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/htm_vpc_3rd_party_cloud_source.svg)

### Requirements for VPC peering connectivity

This connectivity method is best suited for sources whose private IP address
can be reached from your Google Cloud VPC network with a direct peering connection,
for example self-hosted sources that reside in Google Cloud. For other types of
sources you might need additional network components such as such as Cloud VPN or
[a reverse proxy VM](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-reverse-proxy.md.txt).

Private IP connectivity with VPC peering requires the following:

- You need to have a [Virtual Private Cloud network with private services access enabled](https://docs.cloud.google.com/vpc/docs/configure-private-services-access.md.txt).

  This is the network that you peer with Database Migration Service and your source
  database server. You need to have enough space to allocate IP ranges
  for both components.
- For Cloud SQL for SQL Server sources: Your source AlloyDB for PostgreSQL must have private
  IP enabled. It needs to be peered to the same VPC network where you intend
  to create the private connectivity configuration for Database Migration Service. You also
  need to
  [set up a reverse proxy Virtual Machine (VM) on Compute Engine](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-reverse-proxy.md.txt).

- For managed sources in Microsoft Azure or Amazon Web Services: You need to
  have a Cloud VPN or Cloud Interconnect configured in the same VPC network
  where you intend to create the private connectivity configuration for Database Migration Service.
  If you can't create the private connectivity configuration in the same VPC
  network, you need to
  [set up a reverse proxy Virtual Machine (VM) on Compute Engine](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-reverse-proxy.md.txt).

> [!NOTE]
> **Note:** To create the VPC peering connection for Database Migration Service, you use the dedicated *private connectivity configuration* that you create and manage in Database Migration Service. This configuration works like a VPC peering connection, but it's easier to configure and manage.

### Configure private IP connectivity with VPC peering

To use private IP connectivity with Virtual Private Cloud peering, your source database
private IP must be reachable from your Virtual Private Cloud. Depending on your network
architecture, you might need to use additional components such as
a reverse proxy VM or Cloud VPN.

To learn more about configuring private IP connectivity for different
database sources, see:

- For self-hosted sources: See
  [Configure private IP connectivity with Virtual Private Cloud peering for self-hosted
  sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-self-hosted#private-vpc-peering).

- For Cloud SQL for SQL Server sources: See
  [Configure private IP connectivity with Virtual Private Cloud peering
  for Cloud SQL for SQL Server sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-csql-sqlserver#private-vpc-peering).

- For Microsoft Azure and Amazon RDS sources: You need Cloud VPN or
  Cloud Interconnect to create the connection to the private IP of your source
  database. See:

  - [Configure private IP connectivity with Virtual Private Cloud peering
    for Microsoft Azure sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-azure-sqlserver#private-vpc-peering).

  - [Configure private IP connectivity with Virtual Private Cloud peering
    for Amazon RDS sources](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/configure-src-connection-aws-rds-sqlserver#private-vpc-peering).

> [!NOTE]
> **Note:** For scenarios where your source can be reached from a **different VPC** than the one where you can create a private connectivity configuration for Database Migration Service, you can use private connectivity with a reverse proxy.

## Source network connectivity decision tree

When you are familiar with all supported source connectivity methods
and their requirements, you can follow the questions in the diagram
to help you pick the right connectivity method for your scenario.
![A decision tree diagram with guiding questions to help you
pick the right connectivity method.](https://docs.cloud.google.com/static/database-migration/docs/images/htm/networking_source_decision_tree.svg) **Figure 7.** Source network connectivity decision tree.

## What's next

- Learn about destination database connectivity. See
  [Networking methods for destination database connectivity](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/networking-methods-destination.md.txt).

- To get a complete, step-by-step migration walkthrough, see
  [SQL Server to AlloyDB for PostgreSQL migration guide](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-alloydb/guide.md.txt).