이 페이지에서는 배포를 만드는 방법을 설명합니다. 배포는 구성에 정의된 리소스 집합의 인스턴스화를 의미합니다. 배포를 만들기 위해서는 요청에 유효한 구성을 제공합니다. 하나의 배포에는 여러 Google Cloud 서비스에서 사용되는 여러 리소스가 포함될 수 있습니다. 배포를 만들 때, Deployment Manager는 해당 Google Cloud API에 기술된 모든 리소스를 만듭니다.
새 배포를 만들 때, 만들려는 리소스가 이미 프로젝트에 있으면 배포로 이를 가져옵니다.
이러한 경우에는 Deployment Manager가 새 리소스를 만들지 않습니다.
기존 리소스를 가져오지 않으려면, 배포에 대해 CREATE 정책을 사용해야 합니다.
리소스를 만드는 데 다음 정책을 사용할 수 있습니다.
CREATE_OR_ACQUIRE - [기본값] Deployment Manager가 프로젝트에 있는 리소스를 사용하거나, 리소스가 없으면 리소스를 만듭니다. 리소스를 가져오기 위해 Deployment Manager는 구성에서 개발자가 만들려는 리소스의 속성을 확인합니다. 동일한 속성의 기존 리소스가 있으면 Deployment Manager가 이 리소스를 배포 중에 가져옵니다.
Deployment Manager가 확인하는 속성은 개발자가 만들려는 리소스 유형에 따라 달라지며 다음을 포함할 수 있습니다.
리소스의 name
리소스의 type
리소스의 zone 또는 region(해당되는 경우)
속성은 리소스의 GET API 요청에 대한 URL의 일부입니다.
리소스를 가져오기 위해 Deployment Manager에서 사용하는 속성을 확인하려면 리소스의 GET 메서드에 대한 API 참고 리소스를 참조하세요. 예를 들어 Compute Engine 인스턴스의 경우 instances.get 메서드의 요청 URL에는 resourceId(구성의 name), zone, project가 포함됩니다.
CREATE - Deployment Manager가 존재하지 않는 리소스를 만듭니다. 구성에 포함된 리소스 중에 프로젝트에 이미 존재하는 리소스가 있을 경우 배포가 실패합니다.
ACQUIRE - Deployment Manager가 CREATE_OR_ACQUIRE와 동일한 기준을 사용하여 이미 있는 리소스를 가져옵니다.
프로젝트에 이미 리소스가 다수 있고 이를 단일 배포로 함께 관리하려면 ACQUIRE 정책을 사용합니다.
템플릿 또는 구성에서는 리소스를 만들 때와 마찬가지로 이러한 리소스의 필수 속성을 제공해야 합니다. 구성에 포함된 리소스가 프로젝트에 없으면 배포가 실패합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-03(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)."]]