Maulik Dholaria
Maulik Dholaria

Reputation: 507

Is there a way to move instance or snapshot across different projects

I am looking to move GCE instance or snapshot to different project I have access to. Is that something available in GCE?

Upvotes: 5

Views: 4414

Answers (1)

Boyan
Boyan

Reputation: 719

There aren't any features by default that would allow you to move them to a different project. However, there are workarounds. The following is probably just one of many ways to do so.

To save a disk across projects you will need to use an image. If you can’t use the standard imagebundle tool, you can use the "dd" command. On a temporary disk that’s bigger than the one you want to image, run this:

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

You can then run the following to copy it over 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 summary, you can make an image of your disk, use GCS to send it to over to another project and then use the 'snapshot' on the newly created disk to have a ready image based on which you can create additional instances for that project.

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

Upvotes: 4

Related Questions