gcp change vpc of instance
The following are steps on how to change the network of an instance from one VPC to another. This is assuming you want to keep the same server name, but will need to make a network change. Unfortunately, changing networks will require creating a new instance. The following are the steps to make that change.
- Keep track of all the disks.
- Keep all disks including boot.
- Stop the instance.
- Create an image of the boot drive. Wait for it to complete.
- Create a similar instance, but do not execute.
- Make the network changes. Save the GCloud CLI command.
- Delete the instance.
- Run the saved command from step 4. This creates a new instance.
- Stop the instance.
- Detach the boot disk.
- Attach all the other disks.
- Boot the instance.