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.
Nesta página você aprende como criar uma implantação. Implantação é uma instanciação de um conjunto de recursos definidos em uma configuração. Você fornece uma configuração válida na solicitação para criar a implantação. Uma implantação pode conter vários recursos em inúmeros serviços do Google Cloud . Quando você cria uma implantação, o Deployment Manager cria todos os recursos descritos nas respectivas APIs do Google Cloud .
Ao criar uma implantação, você cria um recurso de implantação que contém uma coleção de recursos. Todo recurso é definido explicitamente em uma configuração fornecida na solicitação.
gcloud
Com a Google Cloud CLI, use o comando deployments create:
A sinalização --config é um caminho relativo para seu arquivo de configuração YAML.
Por padrão, se sua configuração incluir recursos que já estão em seu projeto, esses recursos serão adquiridos pela implantação e poderão ser gerenciados usando a implantação. Se não quiser adquirir um recurso, você precisa usar a opção --create-policy, como no seguinte comando gcloud beta:
Caso importe modelos, você também precisa fornecer esses modelos como parte do corpo da solicitação. Por exemplo, a seguinte solicitação de API tem um target que importa um modelo, denominado vm_template.jinja:
Quando você cria uma implantação, se um recurso a ser criado já existir em seu projeto, ele será adquirido pela implantação.
Nesses casos, o Deployment Manager não criará um novo recurso.
Se você não quiser adquirir um recurso existente, deverá usar a política CREATE em sua implantação.
Você pode usar as seguintes políticas para criar seus recursos:
CREATE_OR_ACQUIRE - [Padrão] o Deployment Manager adquire recursos que existem no projeto ou cria recursos caso eles não existam. Para adquirir um recurso, o Deployment Manager verifica sua configuração para as propriedades do recurso que você está tentando criar. Se houver um recurso atual com as mesmas propriedades, o Deployment Manager vai adquirir esse recurso como parte da implantação.
As propriedades que o Deployment Manager verifica dependem do tipo de
recurso que você está criando e podem incluir:
O name do recurso
O type do recurso
O zone ou region do recurso, se aplicável
As propriedades fazem parte do URL da solicitação da API GET para o recurso.
Para saber quais propriedades o Deployment Manager usa para adquirir um recurso, consulte a documentação da API para o método GET do recurso. Por exemplo, para instâncias do Compute Engine, o URL de solicitação para o método instances.get inclui o resourceId (name na sua configuração), zone e project.
CREATE: o Deployment Manager cria recursos que não existem. Se algum dos recursos da sua configuração já existir no projeto, a implantação vai falhar.
ACQUIRE: o Deployment Manager adquire recursos que já existem usando os mesmos critérios que CREATE_OR_ACQUIRE.
Use a política ACQUIRE se você já tiver vários recursos em seu projeto e quiser gerenciá-los juntos, como uma única implantação.
Em seu modelo ou sua configuração, você precisa informar as propriedades necessárias para esses recursos como se eles estivessem sendo criados. Se algum dos recursos em sua configuração não existir no projeto, a implantação falhará.
Listagem das implantações
Confira uma lista das suas implantações no Google Cloud console, na API ou na Google Cloud CLI.
Console
Acesse a página Implantações no console Google Cloud .
gcloud
Com a Google Cloud CLI, use o subcomando deployments list:
gcloud deployment-manager deployments list
API
Na API, faça uma solicitação GET vazia para a coleção Deployments:
GET https://www.googleapis.com/deploymentmanager/v2beta1/projects/myproject/global/deployments
[[["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\u003eA deployment is the instantiation of resources defined in a configuration, creating them across various Google Cloud services as outlined.\u003c/p\u003e\n"],["\u003cp\u003eDeployments are created using either the \u003ccode\u003egcloud\u003c/code\u003e command-line tool with the \u003ccode\u003edeployments create\u003c/code\u003e command or through an API \u003ccode\u003einsert()\u003c/code\u003e request, providing a configuration file or inline configuration.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e--config\u003c/code\u003e flag in the \u003ccode\u003egcloud\u003c/code\u003e command-line tool specifies the path to the YAML configuration file which contains the parameters of your deployment.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating a deployment, you can use policies like \u003ccode\u003eCREATE_OR_ACQUIRE\u003c/code\u003e (default), \u003ccode\u003eCREATE\u003c/code\u003e, or \u003ccode\u003eACQUIRE\u003c/code\u003e to manage how existing resources in your project are handled.\u003c/p\u003e\n"],["\u003cp\u003eThe list of the current deployments can be viewed from the console, with the gcloud \u003ccode\u003edeployments list\u003c/code\u003e command, or with an API \u003ccode\u003eGET\u003c/code\u003e request.\u003c/p\u003e\n"]]],[],null,["# Creating a Deployment using gcloud or the API\n\nThis page describes how to create a deployment. A deployment is an\ninstantiation of a set of resources that are defined in a\n[configuration](/deployment-manager/docs/configuration). You provide a valid\nconfiguration in the request to create the deployment. A deployment can contain\na number of resources, across a variety of Google Cloud services. When\nyou create a deployment, Deployment Manager creates all of the\ndescribed resources in the respective Google Cloud APIs.\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- Create a [configuration](/deployment-manager/docs/configuration/create-configuration-file).\n\nCreating a deployment\n---------------------\n\nWhen you create a deployment, you are creating a\n[Deployment resource](/deployment-manager/docs/reference/latest/deployments)\nthat contains a collection of resources. Each resource is explicitly defined\nin a configuration that you provide in your request. \n\n### gcloud\n\nWith the Google Cloud CLI, use the `deployments create` command: \n\n gcloud deployment-manager deployments create my-first-deployment \\\n --config vm.yaml\n\nThe `--config` flag is a relative path to your YAML configuration\nfile.\n\nBy default, if your configuration includes resources that are already\nin your project, those resources are acquired by the deployment, and can\nbe managed using the deployment. If you don't want to acquire a resource,\nyou must use the `--create-policy` option, as in the following `gcloud beta`\ncommand: \n\n gcloud beta deployment-manager deployments create my-first-deployment \\\n --config vm.yaml --create-policy CREATE\n\nFor information on what policies you can use when you are creating\ndeployments, see [Setting the policy for creating resources](#create-policy).\n\nIf your deployment is successfully created, you can get a description\nof the deployment: \n\n gcloud deployment-manager deployments describe my-first-deployment\n\n### API\n\nIn the API, make an [`insert()`](/deployment-manager/docs/reference/latest/deployments/insert)\nrequest with the configuration provided inline, in the request body: \n\n POST https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments\n\n {\n \"name\": \"example-config-with-templates\",\n \"target\": {\n \"config\": {\n \"content\": \"resources:\\n- name: vm-created-by-cloud-config\\n type: compute.v1.instance\\n properties:\\n zone: us-central1-a\\n machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1\\n disks:\\n - deviceName: boot\\n type: PERSISTENT\\n boot: true\\n autoDelete: true\\n initializeParams:\\n diskName: disk-created-by-cloud-config\\n sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20151104\\n networkInterfaces:\\n - network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\\n\"\n }\n }\n }\n\nIf you import [templates](/deployment-manager/docs/configuration/templates/create-basic-template), you must also provide those\ntemplates as part of the request body. For example, the following API request\nhas a `target` that imports one template, named `vm_template.jinja`: \n\n POST https://www-www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments\n\n {\n \"name\": \"my-example-config-with-templates-2\",\n \"target\": {\n \"config\": {\n \"content\": \"imports:\\n- path: vm_template.jinja\\n\\nresources:\\n- name: my-vm\\n type: vm_template.jinja\"\n },\n \"imports\": [\n {\n \"content\": \"resources:\\n- name: vm-created-by-cloud-config\\n type: compute.v1.instance\\n properties:\\n zone: us-central1-a\\n machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1\\n disks:\\n - deviceName: boot\\n type: PERSISTENT\\n boot: true\\n autoDelete: true\\n initializeParams:\\n diskName: disk-created-by-cloud-config\\n sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20151104\\n networkInterfaces:\\n - network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\",\n \"name\": \"vm_template.jinja\"\n }\n ]\n }\n }\n\n| **Note:** When you use the API to create a deployment, the operation might take a substantial length of time to complete. For guidelines on checking the operation's status, read about [managing long-running operations](/deployment-manager/docs/reference/managing-long-running-operations).\n\nSetting the policy for creating resources\n-----------------------------------------\n\n|\n| **Beta**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nWhen you create a new deployment, if a resource that you want to\ncreate already exists in your project, it is acquired by the deployment.\nIn such cases, Deployment Manager does not create a new resource.\nIf you do not want to acquire an existing resource, you\nmust use the `CREATE` policy for your deployment.\n\nYou can use the following policies for creating your resources:\n\n- `CREATE_OR_ACQUIRE` - **\\[Default\\]** Deployment Manager acquires\n resources that exist in the project, or creates resources if they do not\n exist. To acquire a resource, Deployment Manager checks your configuration\n for the properties of the resource you are trying to create. If there is an\n existing resource with the same properties, Deployment Manager acquires\n that resource as part of your deployment.\n\n The properties that Deployment Manager checks depend on the type of\n resource you are creating, and might include:\n - The `name` of the resource\n - The `type` of the resource\n - The `zone` or `region` of the resource, if applicable\n\n The properties are part of the URL for `GET` API request for the resource.\n To see which properties Deployment Manager uses to acquire a resource,\n see the API documentation for the resource's `GET` method. For example,\n for Compute Engine instances, the request URL for\n [`instances.get`](/compute/docs/reference/rest/v1/instances/get) method\n includes the `resourceId` (`name` in your configuration), `zone`, and\n `project`.\n | **Note:** If you want to acquire a resource, you must provide all the required properties of the resource, as if you were creating it.\n- `CREATE` - Deployment Manager creates resources that do not exist. If any\n of the resources in your configuration already exist in the project, the\n deployment fails.\n\n- `ACQUIRE` - Deployment Manager acquires resources that already exist,\n using the same criteria as `CREATE_OR_ACQUIRE`.\n\n Use the `ACQUIRE` policy if you have a number of resources already in your\n project, and want to manage them together, as a single deployment.\n\n In your template or configuration, you must provide the required\n properties for these resources as if you are creating them. If any of\n the resources in your configuration do not exist in the project, the\n deployment fails.\n | **Warning:** Do not acquire resources that are already part of another deployment. If you do, any changes you make to one deployment can cause unexpected behavior with the resources in the other deployment.\n\nListing your deployments\n------------------------\n\nView a list of your deployments in either the [Google Cloud console](https://console.cloud.google.com/), the API,\nor the Google Cloud CLI. \n\n### Console\n\nGo to the [**Deployments**](https://console.cloud.google.com/project/_/deployments) page\nin the Google Cloud console.\n\n### gcloud\n\nWith the Google Cloud CLI, use the `deployments list` subcommand: \n\n gcloud deployment-manager deployments list\n\n### API\n\nIn the API, make an empty `GET` request to the Deployments collection: \n\n GET https://www.googleapis.com/deploymentmanager/v2beta1/projects/myproject/global/deployments\n\nWhat's next\n-----------\n\n- Add [labels to your deployment](/deployment-manager/docs/deployments/add-labels-deployments).\n- [Update your deployment](/deployment-manager/docs/deployments/updating-deployments)."]]