migrate gcp vm to another network
Here are the steps how to migrate a GCP VM from one network to another. It involves recreating the instance in that network.
- Find the VM. Click the ‘Create Similar’ button.
- Select the new network. Save Network. Everything else should stay the same.
- Don’t click Create, but get the ‘Create Similar’ command line script only. Click Cancel after.
- Make sure to edit the hostname. GCP appends a ‘-1’ at the end of hostname.
- Edit VM to keep all disks. Delete VM. Make sure to preserve boot drive.
- Run the ‘Create Similar’ command line script you capture to create new VM in the new network.
- The new VM will be based on golden image.
- Stop VM. Swap new disks with old disks.
- Start VM.
- Done.