Stay organized with collections Save and categorize content based on your preferences.
If your source database is inside a VPN (in AWS, for example, or your on-premises VPN), you also need to use a VPN on the destination side to connect to the source.
There are many VPN products you can use. The steps to configure VPNs vary from one product to another, but all of them are fundamentally similar. This section contains examples using AWS and Google Cloud VPNs.
The source database server's firewall must be configured to allow the entire internal IP range allocated for the private service connection of the VPC network that the Cloud SQL destination instance is going to use.
To find the internal IP range in the console:
Go to the VPC networks page in the Google Cloud console.
Select the VPC network that you want to use.
Select Private services access > Allocated IP ranges for services.
Find the Internal IP range associated with the connection created by servicenetworking-googleapis-com.
Find more complete, step-by-step documentation in the following links:
Put together, the overall sequence of steps looks like the following:
Pre-shared key
and key type from the AWS configuration you downloaded earlier in this procedure.IP Sec Tunnel
sections of the AWS configuration file you downloaded earlier in this procedure.The VPN tunnels should begin communicating shortly. On the AWS side, in the VPC Dashboard, the tunnel statuses are UP
. On the GCP side, view the traffic between the VPNs in the Cloud Logging console in the Cloud VPN gateway
project.
To get VPC Peering with an HA VPN (dynamic routes) to AWS, you need to export BGP routes to the Cloud SQL peered VPC, and create a custom advertised route in Cloud Router for the Cloud SQL peered VPC imported route. At that point, Cloud Router is advertising AWS routes to the Cloud SQL VPC and the other way around. The firewall rules on both sides also need to match the Cloud SQL peering route CIDR.
On the AWS side, you can follow the first three steps in Example 1, except select Dynamic instead of Static under Routing options.
Import Custom Routes
and Export Custom Routes
in the VPC Peering connection details, and click SAVE.
The peering now receives dynamic routes from your VPC like the routes coming from BGP peers. This allows traffic from the VPN to the peered network. However, Cloud Router is not yet advertising this route to other networks. To do so, you need to add custom advertised routes in the Cloud Router so that your VPC advertises the imported routes to other networks. For more information, see Importing and exporting custom routes.
TCP port 5432
. Connectivity can now be established.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."],[[["To connect a source database within a VPN (e.g., AWS or on-premises) to a destination, a VPN must also be used on the destination side."],["The source database server's firewall must allow the entire internal IP range allocated for the private service connection of the VPC network used by the Cloud SQL destination instance."],["When using AWS with Google Cloud Classic VPN, you need to reserve a static IP address in Google Cloud, create a customer gateway and virtual private gateway in AWS, and configure VPN connections with static routing on both sides."],["When using AWS with Google Cloud HA VPN, you need to configure VPC peering and export BGP routes to the Cloud SQL peered VPC, creating custom advertised routes in Cloud Router and ensuring firewall rules match the Cloud SQL peering route CIDR."],["When using an HA VPN, you must ensure routes are allowed to propagate in the AWS route tables, by making sure that the range of the IP address for the destination is present, pointing to the proper Virtual Private Gateway."]]],[]]
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