Der Support für Cloud Deployment Manager endet am 31. Dezember 2025. Wenn Sie derzeit Deployment Manager verwenden, müssen Sie bis zum 31. Dezember 2025 zu Infrastructure Manager oder einer alternativen Bereitstellungstechnologie migrieren, damit Ihre Dienste ohne Unterbrechung weiterlaufen.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie Ihr Projekt so konfigurieren, dass Deployment Manager mithilfe von Images von Betriebssystemen, die zu anderen Projekten gehören, VM-Instanzen in Compute Engine erstellen kann.
Angenommen, Sie haben ein Projekt mit dem Namen "Awesome Project", bei dem von Deployment Manager VM-Instanzen erstellt und verwaltet werden. Nehmen wir außerdem an, dass Sie private Images verwenden, die zu einem anderen Projekt namens "Datenbank-Images" gehören.
Wenn Zugriff auf diese Images erforderlich ist, muss der Inhaber von "Datenbank-Images" dem Google APIs-Dienstkonto des Projekts "Beispielprojekt" die IAM-Rolle roles/compute.imageUser zuweisen. Im Projekt "Beispielprojekt" können dann Images aus dem Projekt "Datenbank-Images" verwendet werden.
Mit dieser Vorgehensweise können Sie auch verwalteten Instanzgruppen Zugriff auf die Images von anderen Projekten gewähren.
Hinweis
Wenn Sie die Befehlszeilenbeispiele in dieser Anleitung verwenden möchten, installieren Sie das gcloud-Befehlszeilentool.
Wenn Sie die API-Beispiele in dieser Anleitung verwenden möchten, richten Sie den API-Zugriff ein.
Die Nutzung dieses Features unterliegt folgenden Bedingungen:
Sie müssen dem Google APIs-Dienstkonto Ihres Projekts die Rolle compute.imageUser auf Projektebene zuweisen.
Durch Zuweisen der Rolle compute.imageUser werden Berechtigungen für alle Images im jeweiligen Projekt erteilt. Images können nicht einzeln freigegeben werden.
Der Inhaber des Projekts, zu dem die Images gehören, auf die Zugriff gewährt werden soll, muss dem Google APIs-Dienstkonto des Projekts, das die Images verwenden möchte, Zugriff gewähren.
Rufen Sie die IAM-Seite in der Google Cloud Console des Projekts auf, das Zugriff auf private Images eines anderen Projekts benötigt.
Wählen Sie bei entsprechender Aufforderung Ihr Projekt aus der Liste aus. Sie müssen hier das Projekt auswählen, das Zugriff auf die Images in einem anderen Projekt benötigt.
Suchen Sie nach dem Google APIs-Dienstkonto, dessen E-Mail-Adresse das folgende Format hat:
Notieren Sie die oben angeführte E-Mail-Adresse. Als Nächstes kann ein Projektinhaber des Projekts, in dem sich die gewünschten Images befinden, dem Google APIs-Dienstkonto die Rolle roles/compute.imageUser zuweisen.
Console
Öffnen Sie in der Google Cloud Console die IAM-Seite des Projekts, das die gewünschten Bilder enthält.
Der Anfragetext muss eine Liste der Bindungen enthalten, die für dieses Projekt gelten sollen. Die Rolle roles/compute.imageUser muss Teil der Bindung sein. Beispiel:
Images von anderen Projekten in der Konfiguration verwenden
Nachdem einem Projekt Zugriff auf Images aus einem anderen Projekt gewährt wurde, können Nutzer des Projekts die Images verwenden. Dazu geben sie in Vorlagen oder Konfigurationen die Projekt-ID des Projekts an, dem die Images zugeordnet sind:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-19 (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)."]]