Il supporto di Cloud Deployment Manager terminerà il 31 dicembre 2025. Se al momento utilizzi Deployment Manager, esegui la migrazione a Infrastructure Manager o a una tecnologia di deployment alternativa entro il 31 dicembre 2025 per assicurarti che i tuoi servizi continuino senza interruzioni.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Una configurazione definisce la struttura del deployment. Devi specificare una configurazione per creare un deployment.
In questo passaggio accederai a una configurazione che crea un deployment con due istanze di macchine virtuali (VM) Compute Engine. Un'istanza VM è uno dei diversi tipi di risorse che puoi eseguire il deployment con Deployment Manager.
In questo passaggio esaminerai una configurazione per un deployment con due istanze VM.
cd deploymentmanager-samples/examples/v2/step_by_step_guide/step2_create_a_configuration
Poi apri two-vms.yaml:
nanotwo-vms.yaml# use your preferred text editor
Nella sezione resources, tieni presente che ci sono due risorse: the-first-vm
e the-second-vm. Ogni risorsa ha un campo name, type e properties:
name: un nome definito per la risorsa.
type: specifica il tipo di risorsa che stai creando. Ad esempio, una VM è compute.v1.instance. Analogamente, un'istanza Cloud SQL
ha il tipo sql.v1beta4.instance.
properties: specifica le proprietà della risorsa. Le proprietà
obbligatorie per creare la risorsa sono le stesse richieste dall'API della risorsa. Ad esempio, quando crei un'istanza VM di Compute Engine, devi fornire un tipo di macchina, un'immagine, un'interfaccia di rete e una specifica del disco di avvio.
Configura il file di configurazione
In two-vms.yaml, sostituisci MY_PROJECT con l'ID del tuo progetto.
# 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
Salva le modifiche.
Questo file di configurazione di base è tutto ciò che ti serve per creare il tuo primo deployment.
Hai dichiarato le risorse che vuoi creare (in questo caso, due istanze VM con tipi di macchine diversi) e Deployment Manager si occupa di crearle.
Nel passaggio successivo, utilizzerai questa configurazione per eseguire il deployment di nuove risorse.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-04-24 UTC."],[[["A configuration defines the structure of a deployment, and it is required to create one."],["This configuration example creates a deployment with two Compute Engine virtual machine (VM) instances, demonstrating how to define resources."],["Each resource within the configuration has a `name`, `type`, and `properties` field, specifying what is created and how."],["The configuration file `two-vms.yaml` details the creation of two distinct VM instances with varying machine types, demonstrating how to specify different types of VMs."],["Deployment Manager uses the defined configuration to create the specified resources, abstracting away the low level creation."]]],[]]