Search code examples
google-cloud-sqlgoogle-app-maker

Connect AppMaker to Google SQL


I tried to connect AppMaker to an existing Google SQL database without success. In Google Cloud, I created a second generation instance (europe-west1) and allow every IP (for the test). Next, I created a user, connected Workbench with the database and created a schema. Without problems. In AppMaker I use the following address to connect to the database:

[domainName:]myprojectID:regionName:myinstanceID/mydatabase (with and without domain)

Feedback:

Unable to connect to Google Cloud SQL instance. The Google Cloud SQL address may be incorrect or this App Maker editor may not have permission to access the database. You can find more information about using Google Cloud SQL in our documentation.

How can I connect to Google SQL with AppMaker?

Thanks.


Solution

  • The process I followed to connect to the database is the following:

    1. Create a second generation instance by following the steps here (Please make sure to follow the steps only for "Create a Cloud SQL instance" and then create a database inside that instance)
    2. Now, go to the IAM & ADMIN section of your project. Click on the blue "add" member option on the top. Type "appmaker-maestro@appspot.gserviceaccount.com" on the "Members" field and from the "Roles" dropdown select Project->Editor
    3. Return to your second generation SQL instance and copy the value of the Instance connection name property of your instance. Example: enter image description here
    4. Follow the steps for second generation found here to connect to the database from AppMaker and when asked for the instance address, type the value you copied on the previous step and add /yourdatabase at the end of it. For example: my-foto-app:us-central1:myinstance/userphotodatabase
    5. You should now be asked to enter the user and password. Do so and you are finished.

    Please note that I haven't tested out this with a europe location but only on a us central location. I hope this helps and works!