-2

How to connect to Cloud SQL instance and insert values in a particular database from an external web application using PHP or Javascript?

Chiro
  • 48
  • 8

1 Answers1

0

The best way to connect to a CloudSQL instance inside the same gcp project is to use private ip, this way you won't need to use the CloudSQL proxy with a service account used to authenticate through the google API. That way is faster and more secure as you do not risk a mistake in the IAM.

To configurate private IP you juste need to follow this doc: https://cloud.google.com/sql/docs/mysql/configure-private-ip

Then you just have to connect to the CloudSQL instance using the IP as you would do for any other non local database.

night-gold
  • 2,202
  • 2
  • 20
  • 31