Google Cloud Platform just recently released a beta feature called detaching and attaching boot disks. Previously, boot disks were permanently attached to their VM instances. Now you have the ability to detach boot disk from your instance and attach it to another instance without deleting the original instance. You can also replace the boot disks for an instance rather than recreating the entire instance. I’ve tested it on my test account, and it works quite nicely.
I have 2 servers called blue-server and red-server. I’m detaching the disks on blue-server and attaching it to the red-server.
gcloud beta compute instances detach-disk blue-server --disk=blue-server --zone us-central1-c gcloud beta compute instances attach-disk red-server --disk=blue-server --zone us-cenrtal1-c gcloud beta compute instances detach-disk red-server --disk=blue-server --zone us-central1-c gcloud beta compute instances attach-disk blue-server --disk=blue-server --zone us-cenrtal1-c
This new GCP feature is still beta. There might be a few quirks here and there, but overall, it’s a must have feature if you are managing OS.