Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share google compute engine images across projects?

From documentation I know that images are global resources that "are accessible by any resource in any zone within the same project".

I am looking for a functionality similar to sharing AMIs within AWS. That is, I create an image, make it public and anyone can use it immediately.

How to best achieve something similar in GCE? The problem is that the image I need to create would be large - around 100GB. So I am looking for a way of sharing the image that wouldn't involve slow copying (e.g. from a bucket in google cloud storage).

like image 500
Jakub Kotowski Avatar asked Jan 02 '14 12:01

Jakub Kotowski


People also ask

What is the difference between Compute Engine and App Engine in GCP?

App Engine is Google's Platform-as-a-Service offering and Compute Engine is Google's Infrastructure-as-a-Service offering. App Engine is great for running web-based apps, line of business apps, and mobile backends. Compute Engine is great for when you need more control of the underlying infrastructure.


1 Answers

You could use Google Cloud Storage, but then you will be charged every time it will be downloaded, and it will take long time (if it is 100 GB).

The better solution is to give the user "Can view" access to your project. Then user can create a instance using your image, using gcloud command line. But be aware, that user will see all that you have in the project, he just won't be able to change it.

This solution is faster, if the owner of the image, has used it in the zone, you want to use. Because the image is cashed there, and it will start instantaneously. Another plus is, that owner doesn't get charged if someone downloads this image.

`gcloud compute instances create [INSTANCE_NAME]
    --image-family [IMAGE_FAMILY]
    --image-project [IMAGE_PROJECT]
    --machine_type=<type-of-machine> 
    --network="default"
    --family my-image-family`

If you want to give access to a larger group of people, you can create a Google group, allow group members "Can view" access to the project. Now you can control who can access it, using your Google group.

like image 79
Andrejs Avatar answered Sep 28 '22 00:09

Andrejs