O Cloud Deployment Manager vai chegar ao fim do suporte em 31 de dezembro de 2025. Se você usa o Deployment Manager, migre para o Infrastructure Manager ou uma tecnologia de implantação alternativa até 31 de dezembro de 2025 para garantir que seus serviços continuem sem interrupções.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página descreve como configurar o projeto para que o Deployment Manager possa criar instâncias de máquina virtual do Compute Engine usando imagens do sistema operacional pertencentes a outro projeto.
Por exemplo, imagine que você criou um projeto denominado Awesome Project, em que o Deployment Manager cria e gerencia instâncias de VM e você precisa usar imagens particulares pertencentes a um projeto diferente, denominado Database Images.
Para conceder acesso a essas imagens, o proprietário do Database Images precisa atribuir o papel roles/compute.imageUser de IAM à conta de serviço de APIs do Google do Awesome Project, que poderá usar as imagens do projeto Database Images.
Ao atribuir o papel compute.imageUser, você concede permissões a todas as imagens no projeto específico. Não é possível compartilhar imagens específicas.
Para conceder acesso a imagens pertencentes a outro projeto, o proprietário do projeto que detém as imagens precisa conceder acesso à conta de serviço de APIs do Google do projeto que pretende usar as imagens.
Acesse a página "IAM" no console Google Cloud do projeto que
precisa de acesso a imagens particulares que pertencem a outro projeto.
Anote o endereço de e-mail acima. Em seguida, o proprietário do projeto em que estão as imagens pretendidas pode conceder o papel roles/compute.imageUser à conta de serviço de APIs do Google.
Console
Ainda no console Google Cloud , acesse a página "IAM" do projeto
que contém as imagens que você quer acessar.
O corpo da solicitação precisa conter a lista de vinculações que você quer aplicar a esse projeto. É preciso que o papel roles/compute.imageUser faça parte da vinculação. Por exemplo:
Como usar imagens de outros projetos na configuração
Depois que um projeto tiver acesso a imagens de outro projeto, os usuários do projeto poderão usar as imagens especificando o ID do projeto a que as imagens pertencem nos seus modelos ou configurações:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)."]]