Skip to content

Connect Python Application on Cloud Run to Cloud SQL database using Language Connector

Notifications You must be signed in to change notification settings

Rohit1024/postgres-python-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connect a Python application on Cloud Run to a Cloud SQL for PostgreSQL database

Using Cloud SQL Python connector to securely connect your Python application to your Cloud SQL database.

This repository will demonstrate how to connect a Python application on Cloud Run to a Cloud SQL for PostgreSQL database securely with a service account using IAM Authentication.

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

INSTANCE_CONNECTION_NAME = "{PROJECT_ID}:{REGION}:{INSTANCE_NAME}"

DB_USER = "sql-client-service-account@{PROJECT_ID}.iam"

DB_PASS = (optional, if followed the cloudsql.iam_authentication)

PRIVATE_IP = (conditional) if true it will use PRIVATE_IP is not set it will use PUBLIC_IP to connect to Cloud SQL

DB_NAME = your-database

Supported Articles

Connect a Python application on Cloud Run to a Cloud SQL for PostgreSQL database

About

Connect Python Application on Cloud Run to Cloud SQL database using Language Connector

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages