Cloudsql-proxy: gcloud sql proxy start ?

Created on 13 Jun 2017  Â·  3Comments  Â·  Source: GoogleCloudPlatform/cloudsql-proxy

Is there a way to run cloudsql-proxy with the user credentials from my local gcloud auth setup, without creating a service account?

Ideally, it would awesome if this was available in gcloud itself and I could just do something like this for dev purposes:

gcloud sql proxy start --instances=project-name:us-region1:db-name=tcp:127.0.0.1:3306

Most helpful comment

Thanks @Carrotman42 — I am not specifying a --credential_file and just using gcloud auth login, but get this when running cloud_sql_proxy -instances=...:

2017/06/13 11:57:42 google: could not find default credentials.
See https://developers.google.com/accounts/docs/application-default-credentials
for more information.

Using this instead worked: gcloud auth application-default login. And thanks for the firewall note, yes definitely!

All 3 comments

If you run "gcloud auth login" and don't specify a --credential_file flag,
then the Proxy will automatically pick up authentication from gcloud.

Also: remember to ensure that your firewall is strict enough that only
hosts that you control have access to the Proxy, given that you're
specifying to accept connections from 0.0.0.0 directly. I just get a little
security conscious when I see people write that out so I want to say that
when I see it :)

Thanks @Carrotman42 — I am not specifying a --credential_file and just using gcloud auth login, but get this when running cloud_sql_proxy -instances=...:

2017/06/13 11:57:42 google: could not find default credentials.
See https://developers.google.com/accounts/docs/application-default-credentials
for more information.

Using this instead worked: gcloud auth application-default login. And thanks for the firewall note, yes definitely!

Was this page helpful?
0 / 5 - 0 ratings