Google Compute Engine: Floating IP

google-cloud-platformgoogle-compute-engine

I've two servers with ephemeral external ips.

ServerA
ServerB

and I've one Static external IP address (A.B.C.D), which is currently attached to ServerA.

ServerA is my primary loadbalancer, and ServerB is my secondary. How can I use a floating IP on Google Cloud.

Do I need to use gcloud? Is this a good solution?

Example command of failover:

gcloud config set project project-name
gcloud compute instances delete-access-config ServerA --access-config-name 'External NAT
gcloud compute instances delete-access-config ServerB --access-config-name 'External NAT'
gcloud compute instances add-access-config ServerB --address A.B.C.D

Best Answer

Posting my comment as an answer for other users looking at this thread:

Support for Virtual IP/Floating IP in GCE is currently not available. Feature request is already created. You can refer to this link to subscribe for the updates. The workaround for now would be to use the GCE Load balancer