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.
Mit einer Konfiguration wird die Struktur einer Bereitstellung definiert. Wenn Sie eine Bereitstellung erstellen möchten, müssen Sie eine Konfiguration angeben.
In diesem Schritt greifen Sie auf eine Konfiguration zu, die eine Bereitstellung mit zwei Compute Engine-VM-Instanzen erstellt. Eine VM-Instanz ist eine von mehreren Ressourcenarten, die Sie mit Deployment Manager bereitstellen können.
In diesem Schritt sehen Sie sich eine Konfiguration für eine Bereitstellung mit zwei VM-Instanzen an.
cd deploymentmanager-samples/examples/v2/step_by_step_guide/step2_create_a_configuration
Öffnen Sie dann two-vms.yaml:
nanotwo-vms.yaml# use your preferred text editor
Im Abschnitt resources gibt es zwei Ressourcen: the-first-vm und the-second-vm. Jede Ressource hat jeweils ein Feld name, type und properties:
name: Ein Name, den Sie für die Ressource festlegen.
type: Gibt die Art der Ressource an, die Sie erstellen. Eine VM ist beispielsweise compute.v1.instance. Bei Cloud SQL-Instanzen ist es ähnlich, denn diese hat den Typ sql.v1beta4.instance.
properties: Gibt die Attribute der Ressource an. Die Attribute, die zum Erstellen der Ressource benötigt werden, sind die gleichen wie die in der jeweiligen API der Ressource. Wenn Sie beispielsweise eine Compute Engine-VM-Instanz erstellen, müssen Sie einen Maschinentyp, ein Image, eine Netzwerkschnittstelle und ein Bootlaufwerk angeben.
Konfigurationsdatei einrichten
Ersetzen Sie in two-vms.yaml den Platzhalter MY_PROJECT durch Ihre Projekt-ID.
# Copyright 2016 Google Inc. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.resources:-name:the-first-vmtype:compute.v1.instanceproperties:zone:us-central1-fmachineType:https://www.googleapis.com/compute/v1/projects/MY_PROJECT/zones/us-central1-f/machineTypes/f1-microdisks:-deviceName:boottype:PERSISTENTboot:trueautoDelete:trueinitializeParams:sourceImage:https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-11networkInterfaces:-network:https://www.googleapis.com/compute/v1/projects/MY_PROJECT/global/networks/defaultaccessConfigs:-name:External NATtype:ONE_TO_ONE_NAT-name:the-second-vmtype:compute.v1.instanceproperties:zone:us-central1-fmachineType:https://www.googleapis.com/compute/v1/projects/MY_PROJECT/zones/us-central1-f/machineTypes/g1-smalldisks:-deviceName:boottype:PERSISTENTboot:trueautoDelete:trueinitializeParams:sourceImage:https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-11networkInterfaces:-network:https://www.googleapis.com/compute/v1/projects/MY_PROJECT/global/networks/defaultaccessConfigs:-name:External NATtype:ONE_TO_ONE_NAT
Änderungen speichern
Zum Erstellen Ihrer ersten Bereitstellung benötigen Sie lediglich diese einfache Konfigurationsdatei.
Sie haben die zu erstellenden Ressourcen deklariert, in diesem Fall die zwei VM-Instanzen mit unterschiedlichen Maschinentypen. Deployment Manager übernimmt dann die Erstellung der Ressourcen.
Im nächsten Schritt verwenden Sie diese Konfiguration, um neue Ressourcen bereitzustellen.
[[["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-09-03 (UTC)."],[[["\u003cp\u003eA configuration defines the structure of a deployment, and it is required to create one.\u003c/p\u003e\n"],["\u003cp\u003eThis configuration example creates a deployment with two Compute Engine virtual machine (VM) instances, demonstrating how to define resources.\u003c/p\u003e\n"],["\u003cp\u003eEach resource within the configuration has a \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003etype\u003c/code\u003e, and \u003ccode\u003eproperties\u003c/code\u003e field, specifying what is created and how.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration file \u003ccode\u003etwo-vms.yaml\u003c/code\u003e details the creation of two distinct VM instances with varying machine types, demonstrating how to specify different types of VMs.\u003c/p\u003e\n"],["\u003cp\u003eDeployment Manager uses the defined configuration to create the specified resources, abstracting away the low level creation.\u003c/p\u003e\n"]]],[],null,["# Understanding configurations\n\nA configuration defines the structure of your deployment. You must specify a\nconfiguration to create a deployment.\n\nIn this step, you will access a configuration that creates a deployment with two\nCompute Engine virtual machine (VM) instances. A VM instance is one of\nseveral kinds of resources you can deploy with Deployment Manager.\n\nIn this step, you'll examine a configuration for a deployment with\ntwo VM instances.\n\nOpen the configuration YAML file\n--------------------------------\n\nChange to the directory you created in\n[Installation and setup](/deployment-manager/docs/step-by-step-guide/installation-and-setup): \n\n cd deploymentmanager-samples/examples/v2/step_by_step_guide/step2_create_a_configuration\n\nThen, open `two-vms.yaml`: \n\n nano two-vms.yaml # use your preferred text editor\n\nIn the `resources` section, note that there are two resources: `the-first-vm`\nand `the-second-vm`. Each resource has a `name`, `type`, and `properties`\nfield:\n\n- `name`: A name that you define for the resource.\n\n- `type`: Specifies what type of resource you're creating. For example, a VM\n is `compute.v1.instance`. Similarly, a Cloud SQL \n\n instance has the type `sql.v1beta4.instance`.\n\n- `properties`: Specifies the properties of the resource. The properties\n required to create the resource are the same properties required by the\n resource's API. For example, when you create a Compute Engine VM\n instance, you must provide a machine type, an image, a network interface,\n and a boot disk specification.\n\nSet up the configuration file\n-----------------------------\n\nIn `two-vms.yaml`, replace \u003cvar translate=\"no\"\u003eMY_PROJECT\u003c/var\u003e with your project\nID. \n\n # Copyright 2016 Google Inc. All rights reserved.\n #\n # Licensed under the Apache License, Version 2.0 (the \"License\");\n # you may not use this file except in compliance with the License.\n # You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n # See the License for the specific language governing permissions and\n # limitations under the License.\n\n resources:\n - name: the-first-vm\n type: compute.v1.instance\n properties:\n zone: us-central1-f\n machineType: https://www.googleapis.com/compute/v1/projects/MY_PROJECT/zones/us-central1-f/machineTypes/f1-micro\n disks:\n - deviceName: boot\n type: PERSISTENT\n boot: true\n autoDelete: true\n initializeParams:\n sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-11\n networkInterfaces:\n - network: https://www.googleapis.com/compute/v1/projects/MY_PROJECT/global/networks/default\n accessConfigs:\n - name: External NAT\n type: ONE_TO_ONE_NAT\n - name: the-second-vm\n type: compute.v1.instance\n properties:\n zone: us-central1-f\n machineType: https://www.googleapis.com/compute/v1/projects/MY_PROJECT/zones/us-central1-f/machineTypes/g1-small\n disks:\n - deviceName: boot\n type: PERSISTENT\n boot: true\n autoDelete: true\n initializeParams:\n sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-11\n networkInterfaces:\n - network: https://www.googleapis.com/compute/v1/projects/MY_PROJECT/global/networks/default\n accessConfigs:\n - name: External NAT\n type: ONE_TO_ONE_NAT\n\nSave your changes\n-----------------\n\nThis basic configuration file is all you need to create your first deployment.\nYou declared the resources that you want to create (in this case, two VM\ninstances that had different machine types), and Deployment Manager takes\ncare of creating the resources.\n\nIn the next step, you use this configuration to deploy new resources."]]