DEV Community


Posted on

How to move Google Cloud images to other accounts

I handle multiple accounts for my customers and i have some images that i want to use on some of those accounts.

You now have different options on how to achieve this. The best one would always have a docker file for your images and use this as a baseline, we will look at this option in another article soon.

The easiest option however is, if we already have an image based on one machine to copy it to the other account.

to create images there are several ways to do it, the easiest way is to create it in you CloudConsole.

Compute Engine => Images => [+] Create Image

alt text

However if you like the console more do it by the command:

gcloud compute images create IMAGE_NAME --source-disk=SOURCE_DISK 

Now that we have an image we want to export it to a cloud storage bucket

gcloud compute images export --destination-uri gs://bucket-name/imagename.tar.gz --image imagename

After this we will find the image as tar.gz file in out Cloud Storage. Now we have to make it available for other users.
To keep it simple we just make it public available.

alt text

The trick is here, add a User with Name allUsers and give it Read access.
Now it's freely downloadable.

Now we switch to the Account where we need the image and import it

gcloud compute images create imagename     --source-uri gs://bucket-name/imagename.tar.gz

That's it.

Please tell me if you want to see Video Tutorials for Google Cloud


Top comments (0)