Open the cloud shell
To list of all supported types
$ gcloud deployment-manager types list
Create a file with extension .yaml. This will be your configuration file.
$ nano vm.yaml
Paste the code below into that file.
# 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: vm-created-by-deployment-manager type: compute.v1.instance properties: zone: us-central1-a machineType: zones/us-central1-a/machineTypes/n1-standard-1 disks: - deviceName: boot type: PERSISTENT boot: true autoDelete: true initializeParams: sourceImage: projects/debian-cloud/global/images/family/debian-9 networkInterfaces: - network: global/networks/default
To close, Press ctrl+x then y to confirm. Then enter. The file will be saved.
Preview a configuration
$ gcloud deployment-manager deployments create example-config --config configuration-file.yaml --preview
Canceling a preview
$ gcloud deployment-manager deployments cancel-preview example-config
Deleting a preview
$ gcloud deployment-manager deployments delete example-config
Deploying a preview
$ gcloud deployment-manager deployments update example-config