I need to migrate a google compute engine instance from one account to another... any easiest tips?
I have looked through the control panel and tried to find a way to export an image and then import to the new account but cannot see this option.
Preliminary note: I'm assuming that when you say "from one account to another", you actually mean "from one project to another", which may or may not belong to the same account. Just in case I'm misunderstanding concepts here.
It's not exactly a trivial task, but it's doable.
Let's say you have Project A, where your original instance resides; and Project B, where you want to replicate the aforementioned instance. Basically, what you have to do is:
In Project A, you have to create a so-called "image bundle" of the persistent disk of interest attached to the instance. This process yields a compressed snapshot of your disk in .tar.gz format, which you can later on upload to Google Cloud Storage for inter-project sharing. This part is explained step-by-step here: Export an Image to Google Cloud Storage. When you're done, remember to (temporarily) share your tarball in order to allow Project B to download it. Pro tip: You can execute the commands shown in that guide in a very convenient way from a Cloud Shell.
In Project B, now you have to create an image from the tarball we just created in step 1. This is described in detail here, although it simply boils down to this command:
$ gcloud compute images create <IMAGE_NAME> --source-uri gs://<PROJECT-A_BUCKET>/<FILE>.tar.gz
At this point, you can go ahead and create a new instance in Project B using this image as the source for its boot disk, making it identical to the original instance in Project A.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With