In the Open in Cloud Shell dialog box, click Confirm to download the sample app code and open the sample app directory in Cloud Shell Editor.
At the Cloud Shell command prompt, run the following command to activate your project:
gcloudconfigsetprojectYOUR-PROJECT-ID
If an Authorize Cloud Shell dialog box appears, then click Authorize.
Upload SSL certs files to certs folder.
From the Explorer navigation menu of Cloud Shell Editor, navigate to the golang-samples/cloudsql/postgres/database-sql/certs folder.
Right-click certs folder in Cloud Shell Editor and select Upload Files
Select following files on your local machine:
client-key.pem
client-cert.pem
server-ca.pem
With the three SSL certificate files selected, click Open to complete the process of uploading the files to Cloud Shell Editor.
From the Explorer navigation menu of Cloud Shell Editor, navigate to and open the golang-samples/cloudsql/postgres/database-sql/cmd/app/app.standard.yaml file.
Copy and paste the following code into the file, replacing the existing file content:
YOUR_DB_PASSWORD with the password of the quickstart-user that you created in Create a user.
INSTANCE_HOST with your instance's Private IP address that appears on the Cloud SQL instances page in the Google Cloud console.
PROJECT_ID with your project ID.
At the Cloud Shell command prompt, in the golang-samples/cloudsql/postgres/database-sql directory, run the following gcloud app deploy command to deploy the sample app to App Engine standard environment.
gcloudappdeploycmd/app/app.standard.yaml
If you're prompted to choose the region for creating the app, then enter the numeric choice for us-central.
When prompted with Do you want to continue?, enter Y.
When the deploy command completes, run the gcloud app browse command:
gcloudappbrowse
Click the generated link to see the sample app running on App Engine standard environment. This environment is connected to Cloud SQL.
Java
Create and download SSL server and client certificates
For Java users, the connector already provides a secure connection so that creating and downloading SSL server and client certificates is unnecessary.
Create a Serverless VPC Connection for connections to the instance via Private IP
In the Google Cloud console, go to the Serverless VPC access - Create connector page.
In the Open in Cloud Shell dialog box, click Confirm to download the sample app code and open the sample app directory in Cloud Shell Editor.
At the Cloud Shell command prompt, run the following command to activate your project:
gcloudconfigsetprojectYOUR-PROJECT-ID
If an Authorize Cloud Shell dialog box appears, then click Authorize.
From the Explorer navigation menu of Cloud Shell Editor, navigate to and open the java-docs-samples/cloud-sql/postgres/servlet/src/main/webapp/WEB-INF/appengine-web.xml file.
Copy and paste the following code into the appengine-web.xml file, replacing the existing file content:
project-name:region-name:instance-name with your instance's Connection name that appears on the Cloud SQL instances page in the Google Cloud console.
my-db-password with the password of the quickstart-user that you created in Create a user.
PROJECT_ID with your project ID.
At the Cloud Shell command prompt, in the java-docs-samples/cloud-sql/postgres/servlet directory, run the following Apache Mavenmvn clean package command to deploy the sample app to App Engine standard environment.
mvncleanpackageappengine:deploy-DskipTests
If you're prompted to choose the region for creating the app, then enter the numeric choice for us-central.
When prompted with Do you want to continue?, enter Y.
When the deploy command completes, run the gcloud app browse command:
gcloudappbrowse
Click the generated link to see the sample app running on App Engine standard environment. This environment is connected to Cloud SQL.
Node.js
Create and download SSL server and client certificates
In the Google Cloud console, go to the Cloud SQL Instances page.
MY_DB_PASSWORD with the password of the quickstart-user that you created in Create a user.
INSTANCE_HOST with your instance's Private IP address that appears on the Cloud SQL instances page in the Google Cloud console.
PROJECT_ID with your project ID.
At the Cloud Shell command prompt, in the nodejs-docs-samples/cloud-sql/postgres/knex directory, run the following gcloud app deploy command to deploy the sample app to App Engine standard environment.
gcloudappdeployapp.standard.yaml
If you're prompted to choose the region for creating the app, then enter the numeric choice for us-central.
When prompted with Do you want to continue?, enter Y.
When the deploy command completes, run the gcloud app browse command:
gcloudappbrowse
Click the generated link to see the sample app running on App Engine standard environment. This environment is connected to Cloud SQL.
Python
Create and download SSL server and client certificates
In the Google Cloud console, go to the Cloud SQL Instances page.
In the Open in Cloud Shell dialog box, click Confirm to download the sample app code and open the sample app directory in Cloud Shell Editor.
At the Cloud Shell command prompt, run the following command to activate your project:
gcloudconfigsetprojectYOUR-PROJECT-ID
If an Authorize Cloud Shell dialog box appears, then click Authorize.
Upload SSL certs files to certs folder.
From the Explorer navigation menu of Cloud Shell Editor, navigate to the python-docs-samples/cloud-sql/postgres/sqlalchemy/certs folder.
Right-click certs folder in Cloud Shell Editor and select Upload Files
Select following files on your local machine:
client-key.pem
client-cert.pem
server-ca.pem
With the three SSL certificate files selected, click Open to complete the process of uploading the files to Cloud Shell Editor.
From the Explorer navigation menu of Cloud Shell Editor, navigate to and open the python-docs-samples/cloud-sql/postgres/sqlalchemy/app.standard.yaml file.
Copy and paste the following code into the file, replacing the existing file content:
YOUR_DB_PASSWORD with the password of the quickstart-user that you created in Create a user.
INSTANCE_HOST with your instance's Private IP address that appears on the Cloud SQL instances page in the Google Cloud console.
PROJECT_ID with your project ID.
At the Cloud Shell command prompt, in the python-docs-samples/cloud-sql/postgres/sqlalchemy directory, run the following gcloud app deploy command to deploy the sample app to App Engine standard environment.
gcloudappdeployapp.standard.yaml
If you're prompted to choose the region for creating the app, then enter the numeric choice for us-central.
When prompted with Do you want to continue?, enter Y.
When the deploy command completes, run the gcloud app browse command:
gcloudappbrowse
Click the generated link to see the sample app running on App Engine standard environment. This environment is connected to Cloud SQL.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
In the Google Cloud console, go to the Cloud SQL Instances page.
Select the quickstart-instance instance to open the Instance details page.
In the icon bar at the top of the page, click Delete.
In the Delete instance dialog box, type quickstart-instance, and then click Delete to delete the instance. Disabling your app stops it from running instances and serving requests. If your app is processing a request, your app completes the request before being disabled.
To disable an App Engine app and retain its data, do the following:
In the Google Cloud console, go to the Settings page:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-17 UTC."],[],[]]