Public IP connectivity is most appropriate when the source database is external to Google Cloud
and has an externally accessible IPv4 address and TCP port. If the source
database is hosted in another VPC in Google Cloud, then the easiest way to
connect the source database with the Cloud SQL instance is by using VPC Peering.
If your source database is external to Google Cloud, then add the destination database's outgoing
IP address (and port 5432) as an inbound firewall rule on the source network. In
generic terms (your specific network settings may differ), do the following:
Open the source database machine's network firewall rules.
Create an inbound rule.
Set the Rule type to PostgreSQL.
Set the Protocol to TCP.
Set the Port range to 5432.
Set the Source IP address to the destination database's outgoing IP address. For example:
12.20.36.126/32. (The /32 designation in CIDR notation limits the
address range to one address only, the one provided. It's setting the subnet
mask to 255.255.255.255). If the Cloud SQL instance you created
is a high availability instance, include the outgoing IP addresses for both
the primary and the secondary instance.
Update the pg_hba.conf file or AWS RDS security groups to accept connections from this IP address.
Save the firewall rule and exit.
It's also highly recommended to use SSL/TLS during the definition of the source
connection profile so that the data sent to and received by the source is
secure.
Learn more
about SSL/TLS certificates for PostgreSQL.
[[["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-04-17 UTC."],[[["Public IP connectivity is suitable for source databases external to Google Cloud with an accessible IPv4 address and TCP port."],["For source databases in another Google Cloud VPC, VPC Peering is the recommended method to connect to the Cloud SQL instance."],["When the source database is external, an inbound firewall rule must be created on the source network, allowing the destination database's outgoing IP address and port 5432."],["The outgoing IP address for a Cloud SQL instance can be found on the SQL Instances page in the Google Cloud Console."],["It's highly recommended to use SSL/TLS for the source connection profile to ensure secure data transmission."]]],[]]