Creating an application with the Cloud database
Let us create a small one-page application to see how to access Cloud SQL for MySQL programmatically. You can try it in any programming language of your choice. I am going to use Java as my preferred language for code samples.
Before stepping into the application, make sure you have the Cloud Functions service account configured for Cloud SQL connections.
Configuring the Cloud Functions service account
Perform the following steps to configure your Cloud Functions service account:
- Go to the Google Cloud console’s IAM page using this link: https://console.cloud.google.com/iam-admin/iam.
- Edit the service account – Compute Engine default service account – to add a role.
- Click on Add another role.
- Add the Cloud SQL Client role.
- Click Save.
Now that the service account is configured, let’s create the functions.
Creating a Cloud Function
Cloud Functions let you create...