One of the things I find a bit difficult with CloudSQL is surprisingly the first thing you need to do – connect.
Being able to connect securely to your CloudSQL instance is sometimes a bit challenging not just in Go, but in Python as well.
In Go, I’ve found out conflicting suggestions and examples and after much trial and error I found a reasonable solution that works well.
After much searching I found CloudSQL Proxy which takes all of the IP white listing and SSL mess away by using direct OAuth APIs to obtain access to the instance.
I know it looks simple enough, but without importing cloudsql-proxy it wouldn’t have been possible to use the “[email protected]udsql(project-id:zone:instance-name)/db” syntax style that is scattered around the net.