Can You Assign the Private IP of One CloudSQL Instance to Another CloudSQL Instance?
→ 日本語版を読むCan the internal IP assigned to one CloudSQL instance be assigned to a different CloudSQL instance?
Here is the background for this question.
Suppose you want to restore a version-upgraded CloudSQL instance using a backup from before the upgrade. In that case, you would need to create a new instance using the pre-upgrade version and then restore from the backup. However, the new instance will naturally be assigned a new internal IP. This means the application side would need to be updated with the new internal IP as the connection target. Changing the connection IP on the application side is very cumbersome, so it would be convenient if you could reassign the internal IP from the old instance to the new one.
However, based on my own research, it is not possible to reassign the private IP of one CloudSQL instance to another instance.
In GCP, you can reserve static internal IP addresses. You can assign a name to a reserved internal IP and treat it as a single resource. A static internal IP address assigned to one VM instance can be reassigned to another VM instance.
However, static internal IP addresses can only be assigned to VMs. This means you cannot assign a reserved static internal IP to CloudSQL.
I investigated other methods as well, but there appears to be no way to reassign the private IP of one CloudSQL instance to another instance.
In that case, the only option to avoid the impact of a CloudSQL internal IP change is to use Cloud DNS to create a private DNS zone and have the application access it by domain name. That way, even if the CloudSQL instance's IP address changes, you only need to update the A record.
By the way, there is a service called Cloud SQL Auth Proxy, but it requires installing a client application on the client side, which did not fit this use case.