Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Authenticating DB from APP

Hi , If I have an App hosted on a GCE and a DB hosted on a different GCE within the same network , what would be the safest way to authenticate the DB from App ?


On AWS I would probably use the Parameter Store, or possibly Secrets Manager to store the database credentials for use by the App on the instance. However, I’m not finding the equivalent on Google Cloud. There are instructions to store secrets in Cloud Storage encrypted with KMS. This could be an option to avoid storing the database credentials on disk or in source code. I don’t know if this is best practice, but you could also store credentials in the instance metadata.

2 Answers

Hello! Ben has offered many good ideas, already, but I’ll just add a little to it.

To start with, you will need to authenticate and authorize DB requests through whatever mechanism the particular database supports. For example, each MySQL instance has its own set of users with passwords and capabilities.

But then the question becomes, "How will you transfer that username/password info to the app?"  And that is exactly the secrets management question that Ben mentioned.  You certainly could use either an object in Cloud Storage or some Compute Engine metadata to make the data available to the instance, but–especially in the case of metadata–you would also want to encrypt that sensitive auth data (i.e. the username/password) and might choose to manage that encryption via Cloud KMS (as Ben linked 🙂 ).  If you’re using GKE, you might involve its secrets-handling functionality.

I hope this helps!


Thank you Ben and Mattias

Mattias Andersson

No problem! 🙂

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?