1

I have been struggling when trying to connect to an instance of Postgresql in Google Cloud Platform (from my machine in my home network), which has a private IP.

I have tried with https://cloud.google.com/sql/docs/postgres/connect-admin-proxy (Proxy cloud sql) but I need my instance to have a public IP, and that is not possible according to the requirements I have. Also I read that I can connect to my VPC using https://cloud.google.com/vpc/docs/configure-serverless-vpc-access , but I have no idea what I have to do.

Does anyone have ever faced a similar issue?

Thanks! I am new at GCP configuration.

wildpopones
  • 35
  • 1
  • 7

2 Answers2

1

You can connect to private IP by having access to the VPC your Cloud SQL instance is paired in. There are instructions under "Connecting from an external source" on the Configuring Private IP page.

However please note that connecting with Public IP with the Cloud SQL proxy is also very secure, and encrypts the data between the proxy and your instance in a similar fashion to how the Cloud VPN works.

kurtisvg
  • 3,412
  • 1
  • 8
  • 24
  • 2
    It's work when you set up a VPN between your On prem and Google Cloud. Here the context is "at home", with personal network. – guillaume blaquiere Dec 01 '20 at 22:11
  • Not sure I follow your comment. Are you implying that it's a lot of work, or that it's "not at home"? For the first, yes it's that way because you are intentionally trying to circumvent the reason private IP exists (to limit access). For the second, GCP doesn't differentiate between your "work" premise and your "home" premise, so the same process works for both. – kurtisvg Dec 02 '20 at 02:48
  • Correct, GCP doesn't make the difference between work and home network. BUT, have you already set up a VPN between GCP and your own home network? You might have the required equipment for this, but most of the time, you can't achieve this! – guillaume blaquiere Dec 02 '20 at 08:33
1

It is not possible out of the box, but you can use openVPN to create a site to client VPN (bastion host) I found an article about how to address this scenario, this is a very elaborate solution as was mentioned on the question comments.

I found this feature request for Cloud SQL to allow connection between on-premise servers to instances with private IP

Jan Hernandez
  • 4,414
  • 2
  • 12
  • 18