Is there a way to move an instance or snapshot in different projects

I want to move a GCE instance or snapshot to another project that I have access to. Is this something available in GCE?

+5
source share
1 answer

By default, there are no functions that allow you to move them to another project. However, there are workarounds. Perhaps this is just one of many ways to do this.

To save the disk in projects, you will need to use an image. If you cannot use the standard imagebundle tool, you can use the "dd" command . On a temporary drive that is larger than the one you want to create, do the following:

$ dd if=/dev/disk/by-id/google-diskname of=disk.img bs=5M 

Then you can run the following to copy it to Google Cloud Storage, for example:

 $ gsutil cp disk.img gs://yourbucket/your-image.img 

And later you can:

 $ gsutil cat gs://yourbucket/your-image.img | \ dd of=/dev/disk/by-id/google-newdisk bs=5M 

In conclusion, you can create an image of your disk, use GCS to send it to another project, and then use the β€œsnapshot” on the newly created disk to have a finished image on the basis of which you can create additional instances for this project.

PS: It is also possible to create custom images for use in GCE. If you create a properly configured custom image, you can load it into any project and create instances directly from it. See this article.

+4
source

Source: https://habr.com/ru/post/1204949/


All Articles