Il supporto di Cloud Deployment Manager terminerà il 31 dicembre 2025. Se al momento utilizzi Deployment Manager, esegui la migrazione a Infrastructure Manager o a una tecnologia di deployment alternativa entro il 31 dicembre 2025 per assicurarti che i tuoi servizi continuino senza interruzioni.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina descrive come configurare il progetto in modo che Deployment Manager possa
creare istanze di macchine virtuali Compute Engine utilizzando
immagini del sistema operativo appartenenti a un altro progetto.
Ad esempio, supponiamo di avere un progetto denominato Awesome Project in cui
Deployment Manager crea e gestisce le istanze VM. Ora supponiamo che tu debba utilizzare immagini private che appartengono a un progetto diverso denominato Database Images.
Per concedere l'accesso a queste immagini, il proprietario di Database Images deve concedere
il ruolo IAM roles/compute.imageUser al
service account delle API di Google
di Awesome Project, che può quindi utilizzare le immagini del progetto Database
Images.
Puoi utilizzare questa procedura anche per concedere ai gruppi di istanze gestite l'accesso alle immagini di altri progetti.
La concessione del ruolo compute.imageUser concede le autorizzazioni per
tutte le immagini nel progetto specifico. Non è possibile condividere immagini specifiche.
Per concedere l'accesso alle immagini che appartengono a un altro progetto, il proprietario del
progetto che possiede le immagini deve concedere l'accesso al service account delle API di Google
del progetto che vuole utilizzare le immagini.
Vai alla pagina IAM nella console Google Cloud del progetto che
deve accedere alle immagini private di proprietà di un altro progetto.
Prendi nota dell'indirizzo email riportato sopra. Successivamente, un proprietario del progetto
in cui si trovano le immagini desiderate può concedere al account di servizio delle API di Google
il ruolo roles/compute.imageUser.
Console
Sempre nella console Google Cloud , vai alla pagina IAM del progetto
che contiene le immagini a cui vuoi accedere.
Il corpo della richiesta deve contenere l'elenco dei binding che vuoi applicare
a questo progetto. Il ruolo roles/compute.imageUser deve far parte
dell'associazione. Ad esempio:
Utilizzo delle immagini di altri progetti nella configurazione
Dopo che a un progetto è stato concesso l'accesso alle immagini di un altro progetto, gli utenti del progetto possono utilizzare le immagini specificando l'ID progetto del progetto a cui appartengono le immagini nei modelli o nelle configurazioni:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-03 UTC."],[[["\u003cp\u003eDeployment Manager can create Compute Engine VM instances using OS images from a different project by granting the \u003ccode\u003eroles/compute.imageUser\u003c/code\u003e IAM role to the Google APIs service account of the project requiring access.\u003c/p\u003e\n"],["\u003cp\u003eTo allow one project to utilize images from another, the image-owning project's owner must grant the \u003ccode\u003eroles/compute.imageUser\u003c/code\u003e role to the requesting project's Google APIs service account.\u003c/p\u003e\n"],["\u003cp\u003eAccess to images from another project is granted at the project level, meaning all images within that project become accessible, and this access is specific to service accounts, not general user groups.\u003c/p\u003e\n"],["\u003cp\u003eOnce access is granted, users can utilize images from the external project in their configurations by specifying the project ID in the image URI, for example: \u003ccode\u003eprojects/[PROJECT_ID]/global/images/[IMAGE_NAME]\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud\u003c/code\u003e command-line tool and the API can be used to add a binding to the IAM policy for the project.\u003c/p\u003e\n"]]],[],null,["# Using Images from Other Projects\n\nThis page describes how to configure your project so that Deployment Manager can\ncreate Compute Engine virtual machine instances using\n[operating system images](/compute/docs/images) that belong to another project.\n\nFor example, assume you have a project named Awesome Project where\nDeployment Manager creates and manages VM instances. Now, let's assume you need\nto use private images that belong to a different project named Database Images.\nTo grant access to these images, the owner of Database Images must grant\nthe IAM role `roles/compute.imageUser` to the\n[Google APIs service account](/deployment-manager/docs/access-control#access_control_for_deployment_manager)\nof Awesome Project, and Awesome Project can then use images from the Database\nImages project.\n\nYou can also use this process to grant\n[managed instance groups](/compute/docs/instance-groups#managed_instance_groups)\naccess to images from other projects.\n\nBefore you begin\n----------------\n\n- If you want to use the command-line examples in this guide, install the [\\`gcloud\\` command-line tool](/sdk).\n- If you want to use the API examples in this guide, set up [API access](/deployment-manager/docs/reference/latest).\n- Read about Deployment Manager [configurations](/deployment-manager/docs/configuration/create-basic-configuration).\n- Read about Compute Engine [private images](/compute/docs/images).\n- Read about [Identity and Access Management (IAM)](/iam) documentation.\n- Read about [Deployment Manager IAM roles](/compute/docs/access/iam#iam_roles), in particular, the `roles/compute.imageUser` role.\n\nLimitations\n-----------\n\nThe following are restrictions for using this feature:\n\n- You must grant the `compute.imageUser` role on the project level to your project's [Google APIs service account](/deployment-manager/docs/access-control#access_control_for_deployment_manager).\n- Granting the `compute.imageUser` role grants permissions to all images in the specific project. It is not possible to share specific images.\n- You must grant this role to specific users, and not to [`allAuthenticatedUsers`](/iam/docs/principals-overview#allauthenticatedusers) or [`allUsers`](/iam/docs/principals-overview#allusers).\n\nGranting access to images\n-------------------------\n\nTo grant access to images that belong to another project, the owner of the\nproject that owns the images must grant access to the Google APIs service\naccount of the project that wants to use the images.\n\n1. Go to the IAM page in the Google Cloud console of the project that needs access to private images owned by another project. [Go to the IAM page](https://console.cloud.google.com/iam-admin/iam/)\n\n2. If prompted, select your project from the list. Remember to select the project that needs access to images stored in another project.\n3. Look for **Google APIs service account**, which has an email address in the\n following format:\n\n [PROJECT_NUMBER]@cloudservices.gserviceaccount.com\n\n | **Note:** This email address requires the project number, which is different than the project ID. To learn how to identify the project number, see [Identifying projects](/compute/docs/projects#projectids).\n4. Make note of the email address above. Next, a project owner of the project\n where the desired images live can grant the Google APIs service account\n the `roles/compute.imageUser` role.\n\n\n ### Console\n\n 1. While still in the Google Cloud console, go to the IAM page of the project that contains the images you want access to. [Go to the IAM page](https://console.cloud.google.com/iam-admin/iam/)\n\n 2. Select the project from the project list.\n 3. Click the **Add** button to add a new member.\n 4. In the **Members** box, enter the email address of the service account.\n 5. Expand the **Roles** dropdown and select **Compute Engine \\\u003e Compute Image User**.\n 6. Click **Add** to add the account.\n\n ### gcloud\n\n With the Google Cloud CLI, add a binding to the IAM policy for the project: \n\n ```\n gcloud projects add-iam-policy-binding [PROJECT_ID] \\\n --member serviceAccount:[SERVICE_ACCOUNT_EMAIL] --role roles/compute.imageUser\n ```\n\n where:\n - `[PROJECT_ID]` is the ID of the project containing images you want to share.\n - `[SERVICE_ACCOUNT_EMAIL]` is the email of the service account.\n\n For example: \n\n ```\n gcloud projects add-iam-policy-binding database-images \\\n --member serviceAccount:123456789012@cloudservices.gserviceaccount.com \\\n --role roles/compute.imageUser\n ```\n\n ### API\n\n In the API, make a `POST` request to the following URL, where\n `[PROJECT_ID]` is the ID of the project containing the images you want to\n share. \n\n POST https://cloudresourcemanager.googleapis.com/v1/projects/$[PROJECT_ID]:setIamPolicy\n\n The request body should contain the list of bindings you want to apply\n to this project. The `roles/compute.imageUser` role should be part\n of the binding. For example: \n\n {\n \"policy\": {\n \"version\": \"0\",\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:example@gmail.com\"\n ]\n },\n {\n \"role\": \"roles/compute.imageUser\",\n \"members\": [\n \"serviceAccount:123456789012@cloudservices.gserviceaccount.com\"\n ]\n }\n ]\n }\n\n }\n\n \u003cbr /\u003e\n\nUsing images from other projects in your configuration\n------------------------------------------------------\n\nAfter a project has been granted access to images from another project, users of\nthe project can use the images by specifying the project ID of the project that\nthe images belong to in your templates or configurations: \n\n image: projects/[PROJECT_ID]/global/images/[IMAGE_NAME]\n\nFor example, if the image project ID is `database-images`, then you might\nprovide the following image URI in your configuration: \n\n```\nresources:\n- name: a-special-vm\n type: compute.v1.instances\n properties:\n machineType: zones/us-central1-a/machineTypes/f1-micro\n image: projects/database-images/global/images/example-database-image\n ...\n```\n\nAfter you have added the image, [finish creating your configuration](/deployment-manager/docs/configuration/create-basic-configuration), then [deploy it](/deployment-manager/docs/deployments).\n\nWhat's next?\n------------\n\n- Learn more about [sharing images](/compute/docs/images/sharing-images-across-projects).\n- Learn more about Compute Engine [images](/compute/docs/images).\n- Read about other [IAM roles](/iam/docs/understanding-roles) you can grant.\n- Learn more about [service accounts](/compute/docs/access/service-accounts)."]]