Google Cloud SQL
Source and destination
Polytomic connects to Google Cloud SQL databases using a Google Cloud service account key. Polytomic supports both database engines:
Both connection types use the same service account key. Create it once using the steps below, then follow the guide for your engine to add the connection.
Prerequisites
Polytomic connects through the Cloud SQL connector, which authorizes connections with your service account key rather than by IP address. Before you add a connection:
- Enable the Cloud SQL Admin API in the project that contains your instance (and in the service account's project, if it's different).
- Give your instance a public IP address. Polytomic connects to the instance's public IP. Polytomic doesn't support instances with only a private IP or Private Service Connect.
- You don't need to add Polytomic's IPs to your instance's authorized networks. The connector doesn't use authorized networks. If you restrict your instance to connector-only connections, Polytomic can still connect.
Create a service account key
-
Go to https://console.cloud.google.com/apis/credentials/serviceaccountkey to create a new service account.
-
Select the Cloud SQL Client role:
- Create and save a JSON service account key file.
You'll upload this key file when you add your connection in Polytomic.
Authenticate with IAM
You can authenticate as the service account itself instead of using a database password (IAM database authentication). To set it up:
-
Turn on IAM authentication for your instance by setting the database flag
cloudsql_iam_authentication(MySQL) orcloudsql.iam_authentication(PostgreSQL) toon. -
Grant the service account the Cloud SQL Instance User role (
roles/cloudsql.instanceUser) in addition to Cloud SQL Client. -
Add the service account to your instance as an IAM user: in the Cloud SQL console, open Users → Add user account → Cloud IAM, and enter the service account's email address. Then grant the database user the permissions described in your engine's guide.
-
In the Polytomic connection, enter the service account's email address (for example,
[email protected]) as the Username and leave Password empty. Polytomic converts the email address to the database username Cloud SQL expects.
Find your connection name
Each connection asks for a Cloud SQL connection name in the form project:region:instance. You'll find this value on your instance's Overview page in the Cloud SQL console, listed as Connection name.
Updated 3 days ago