How to share google compute engine images across projects?

Viewed 7021

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).

4 Answers

One can simply grand roles/compute.imageUser access to a service account of <ID-of-your-project> that is used for creating instances:

gcloud projects add-iam-policy-binding <ID-of-image-owners-project> \
  --member serviceAccount:account-to-create-instances@<ID-of-your-project>.iam.gserviceaccount.com \
  --role roles/compute.imageUser
Related