Zama Ques
Zama Ques

Reputation: 1534

Converting CloudSQL instances from Public to Private IP

Can't we convert a CloudSQL instance with Public IP to a Private IP. The Private IP is on SharedVPC allocated using Private service Connection .

It is failing for me with below error

   $ gcloud --project=<project id> beta sql instances patch test1-instance --network=https://www.googleapis.com/compute/alpha/projects/<SharedVPC Host Project>/global/networks/kube-shared-vpc                                                                                                                         
   The following message will be used for the patch API method.
   {"name": "test1-instance", "project": "<project-id>", "settings": {"ipConfiguration": {"privateNetwork": "https://www.googleapis.com/compute/alpha/projects/<SharedVPC Host Project>/global/networks/kube-shared-vpc"}}}

   ERROR: (gcloud.beta.sql.instances.patch) HTTPError 400: This operation is not valid for this instance.

It works if the private IP is on the same network of CloudSQL instances but when private IP is allocated from SharedVPC it is not working

Upvotes: 0

Views: 869

Answers (1)

Mahboob
Mahboob

Reputation: 1955

It is not possible to enable Private IP on existing Cloud SQL instance when trying to attach the instance to a Shared-VPC and there is PIT on this issue as Feature Request to enable that. The current workaround is to enable the Private IP on Cloud SQL instances at creation time.

Upvotes: 2

Related Questions