Google Cloud SQL Database

Connecting to Google Cloud SQL database.

Introduction

This tutorial shows you how to create and configure a cloud SQL database for your Google Cloud account, as well as how to gain access, which enables you to control and connect it with API Express.

Setting up Database

  1. Open the Google Developers Console
  2. To create an SQL cloud click on the Products & services menu on the left where it states Google Developers Console.
  3. In the pop-up list select Storage > SQL and click Create Instance.
  4. Now select the required generation.
  5. Define the remaining parameters such as: Instance ID, Region and Tier, then click Create.
  6. By default, you are in the Overview tab, but there are also Database, Access Control, Replicas and Operations tabs.

Adding And Configuring Google Cloud Database

  1. To create a new SQL database to be used with Appery.io API Express, open the Databases tab and click New database.
  2. Enter the database name and click Add.
  3. Now, you can configure Access Control to your instance with the database. To do this, switch to the Access Control tab.
  4. In the new window, select the IP address option and click Request IPv4 address to be able to use it with the API Express services.
  5. Then, switch to the Users tab and click Create user account.
  6. Create new user accounts to access your database with hosts restriction, and add access for these hosts using their actual IP addresses

📘

IP Address

To find out your current IP address for nodes please go back to Working with an Microsoft Azure Account in this document.

  1. Now, go to the Authorization tab and add an authorized network under the corresponding panel by clicking on + Add item.
  2. Provide access for all nodes described above using the actual IP addresses.
  3. Add the authorized networks and click Save.

📘

Google Manuals

You can find information on how to grant access to an external application in Google manuals here.

How To Configure Firewall Rules

Please follow the steps in Exposing Your Database to API Express.

Creating API Express Database Connection

  1. Login to your Appery online account.
  2. In the Appery.io builder, go to the API Express tab and click Create new DB connection, fill in all the required information and enter its name.
  3. In the next window, add your Database connection name, select MySQL as Database type, and add Host (IPv4 address attached to your Cloud SQL instance – see above).
  4. Now, define Port (3306 – the default MySQL port), Database name, Username and Password for your MySQL DB (Google Cloud account) created earlier (see above).

👍

Click Save

You have now created an Appery.io DB connection. To ensure that the connection from the API Express services to your Google SQL Cloud works, click Test.