santosh
Jun 15, 2023

Go lang service connecting to Google Cloud SQL Postgres with IAM service accounts and without password

Problem Statement

We are having postgres database in cloud sql in Google cloud

Our application is developed in Go lang and it need to connect to postgres

database using service account IAM authentication and without password

Step 1:

Configure Cloud SQL for IAM Authentication

Use this google documentation link_to_google_documentation for configuring cloud sql for iam authentication

Step 2:

Adding service account user to cloud sql

Use google documentation link for adding service account user to the database having correct rights and privilege's

Step 3:

Sample code connecting to postgres cloud sql with service account authentication.

Here one need to replace placeholders dbUserName, dbName, instanceConnectionName as per their environment.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

santosh
santosh

No responses yet

Write a response