Skip to main content

Google Cloud SQL

This guide explains how to connect Google Cloud SQL to a PolyScale cache. Google Cloud SQL offers a fully managed relational database service for MySQL, PostgreSQL, and SQL Server with rich extension collections, configuration flags, and developer ecosystems. As such, Google Cloud database instances can be connected to PolyScale just like any other database. Read on for details of working with Google Cloud SQL and PolyScale.

Create Cache

Step 0: Create a PolyScale account

If you do not already have a PolyScale account, you can create an account here. PolyScale offers a free tier and no credit card is required.

Step 1: Create your PolyScale Cache

1.1 Retrieve your Google Cloud SQL Host

From the Google Cloud SQL Overview, copy the Public IP address for the instance for which you want to create a cache.

Create Cache

1.2 Configure your PolyScale Cache

  • In your PolyScale account, click on the New Cache button
  • Give the cache a Name
  • Select PostgreSQL for the Type
  • Enter the Host from Step 1.1 above
  • Enter 5432 for the Port
  • Click Create
Create Cache
tip

The above example is for a Google Cloud SQL Postgres instance. For MySQL or SQL Server, be sure to use the appropriate Type and Port.

Your cache is now created. PolyScale automatically checks to see that your database is accessible from all our global PoPs.

tip

Your database must allowlist all the locations for the PolyScale Edge Network. If your database is not accsesible from any of the locations, you can use this script to open your instance to the PolyScale edge network.

Step 2: Connect to your PolyScale Cache

Using your PolyScale cache is simple -- instead of connecting to your Google Cloud SQL database directly, you'll replace your original connection string with the PolyScale connection string in your application.

For example, for a Postgres instance, if your original connection string was: postgres://postgres:zqGHFAbPLvVCKw@35.235.175.35:5432/employees

Your PolyScale connection string would be: postgres://postgres:zqGHFAbPLvVCKw@psedge.global:5432/employees?application_name=a645cb93-fa53-46b2-9d6c-227e357e5bfb

For examples of connection strings for other database types, see our Getting Connected documentation.

That's it.