properties:指定资源的属性。创建资源所需的属性与相应资源的 API 所需的属性相同。例如,创建 Compute Engine 虚拟机实例时,您必须提供机器类型、映像、网络接口和启动磁盘规范。
设置配置文件
在 two-vms.yaml 中,将 MY_PROJECT 替换为您的项目 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
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-31。"],[[["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."]]],[]]