How to move a GCloud instance across two different Google projects ?
I got this problem from one of my mentees who wanted to move instances across projects — not just the image, but the disk and the data it has.
Before starting how to do this, let's get familiar with some of the jargons of Google Cloud.
The process outline:
Before starting anything, make sure your instance serves no traffic or less traffic, which is negligible, and does not affect your business
- Create a snapshot of the disk used by the instance
- Create a disk out the snapshot
- Create an image out the disk
- Swith to the other project from terminal
- Create an instance out of the image created at step 3. The image will be available publicly and will be accessible via URL
Note: If there exists a persistent disk, make sure to clone and mount it inside the new instance. If that's not possible, SCP all of the files to another instance that has another persistent disk mounted in it.
Make sure you have write access to both of the projects. If you need more help in migrating projects, feel free to contact me!