Dieser Inhalt ist noch nicht für Mobilgeräte optimiert.
Die Lernumgebung funktioniert am besten, wenn Sie auf einem Computer über einen per E‑Mail gesendeten Link darauf zugreifen.
Overview
In this lab, you create a deployment using Deployment Manager and use it to maintain a consistent state of your deployment. You will also view resource usage in a VM instance using Cloud Monitoring.
Objectives
In this lab, you will learn how to perform the following tasks:
Create a Deployment Manager deployment.
Update a Deployment Manager deployment.
View the load on a VM instance using Cloud Monitoring.
Task 1. Sign in to the Google Cloud Platform (GCP) Console
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Google Skills using an incognito window.
Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
Task 2. Confirm that needed APIs are enabled
Make a note of the name of your GCP project. This value is shown in the top bar of the Google Cloud Platform Console. It will be of the form qwiklabs-gcp- followed by hexadecimal numbers.
In the GCP Console, on the Navigation menu (), click APIs & services.
Scroll down in the list of enabled APIs, and confirm that these APIs are enabled:
Cloud Deployment Manager v2 API
Cloud Runtime Configuration API
Stackdriver monitoring API
If one or more APIs is missing, click the Enable APIs and Services button at top. Search for the above APIs by name and enable each for your current project. (You noted the name of your GCP project above.)
Task 3. Create a Deployment Manager deployment
In GCP console, on the top right toolbar, click the Activate Cloud Shell button (). Click Continue.
For your convenience, place the zone that Google Skills assigned you to into an environment variable called MY_ZONE. At the Cloud Shell prompt, type this partial command:
export MY_ZONE=
followed by the zone that Google Skills assigned you to. Your complete command will look similar to this:
export MY_ZONE={{{project_0.default_zone|Zone}}}
At the Cloud Shell prompt, download an editable Deployment Manager template:
In the Cloud Shell, use the sed command to replace the PROJECT_ID placeholder string with your Google Cloud Platform project ID using this command:
sed -i -e "s/PROJECT_ID/$DEVSHELL_PROJECT_ID/" mydeploy.yaml
In the Cloud Shell, use the sed command to replace the ZONE placeholder string with your Google Cloud Platform zone using this command:
sed -i -e "s/ZONE/$MY_ZONE/" mydeploy.yaml
In the Cloud Shell, use the sed command to replace the n1-standard-1 machine type to e2-medium using this command:
sed -i -e "s/n1-standard-1/e2-medium/" mydeploy.yaml
View the mydeploy.yaml file, with your modifications, with this command:
cat mydeploy.yaml
The file will look something like this:
resources:
- name: my-vm
type: compute.v1.instance
properties:
zone: {{{project_0.default_zone|Zone}}}
machineType: zones/{{{project_0.default_zone|Zone}}}/machineTypes/e2-medium
metadata:
items:
- key: startup-script
value: "apt-get update"
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-9-stretch-v20180806
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-dcdf854d278b50cd/global/networks/default
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
Note: Do not use the above text literally in your own mydeploy.yaml file. Be sure that the zone that is named on the zone: and machineType: lines in your file matches the zone to which Google Skills assigned you. Be sure that the project ID on the network: line in your file matches the project ID to which Google Skills assigned you, not the one in this example.
When the deployment operation is complete, the gcloud command displays a list of the resources named in the template and their current state.
Confirm that the deployment was successful. In the GCP Console, on the Navigation menu (), click Compute Engine > VM instances.
You will see that a VM instance called my-vm has been created, as specified by the template.
Click on the VM instance's name to open its VM instance details screen.
Scroll down to the Custom metadata section. Confirm that the startup script you specified in your Deployment Manager template has been installed.
Click Check my progress to verify the objective.
Create a Deployment Manager deployment
Task 4. Update a Deployment Manager deployment
Return to your Cloud Shell prompt. Launch the nano text editor to edit the mydeploy.yaml file:
nano mydeploy.yaml
Find the line that sets the value of the startup script, value: "apt-get update", and edit it so that it looks like this:
Do not disturb the spaces at the beginning of the line. The YAML templating language relies on indented lines as part of its syntax. As you edit the file, be sure that the v in the word value in this new line is immediately below the k in the word key on the line above it.
Press Ctrl+O and then press Enter to save your edited file.
Press Ctrl+X to exit the nano text editor.
Return to your Cloud Shell prompt. Enter this command to cause Deployment Manager to update your deployment to install the new startup script:
Wait for the gcloud command to display a message confirming that the update operation was completed successfully.
In the GCP console, on the Navigation menu (), click Compute Engine > VM instances.
Click on the my-vm VM instance's name to open its VM instance details pane.
Scroll down to the Custom metadata section. Confirm that the startup script has been updated to the value you declared in your Deployment Manager template.
Click Check my progress to verify the objective.
Update the Deployment Manager deployment
Task 5. View the Load on a VM using Cloud Monitoring
In the GCP Console, on the Navigation menu (), click Compute Engine > VM instances.
Select the checkbox for my-vm and click on STOP.
Click on STOP again to confirm.
Click on the VM instance's name to open its VM instance details screen.
Click on EDIT (pencil icon).
Scroll down to the bottom of the page and select Compute Engine default service account from Service account dropdown.
Select Allow full access to all Cloud APIs for Access scopes.
Click on Save.
Now, restart the VM by clicking on Start at the top of the VM instance details screen page.
Click on START again to confirm.
In the GCP Console, on the Navigation menu (), click Compute Engine > VM instances.
To open a command prompt on the my-vm instance, click SSH in its row in the VM instances list.
In the ssh session on my-vm, execute this command to create a CPU load:
dd if=/dev/urandom | gzip -9 >> /dev/null &
This Linux pipeline forces the CPU to work on compressing a continuous stream of random data.
Note: Leave the window containing your SSH session open while you proceed with the lab.
Create a Monitoring workspace
You will now setup a Monitoring workspace that's tied to your Google Cloud Project. The following steps create a new account that has a free trial of Monitoring.
In the Cloud Console, click on Navigation menu > Monitoring.
Wait for your workspace to be provisioned.
When the Monitoring dashboard opens, your workspace is ready.
Click on Settings option from the left panel and confirm that the GCP project created for you is shown under the GCP Projects section.
Run the commands shown on screen in the SSH window of your VM instance to install both the Monitoring and Logging agents.
Once both of the agents have been installed on your project's VM, click Metrics Explorer under the main Cloud Monitoring menu on the far left.
In the Metrics Explorer pane, Click on Select a Metric dropdown under Resource & Metric and then select VM instance > Instance > CPU usage.
Click Apply.
In the resulting graph, notice that CPU usage increased sharply a few minutes ago.
Terminate your workload generator. Return to your ssh session on my-vm and enter this command:
kill %1
End your lab
When you have completed your lab, click End Lab. Google Skills removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
1 star = Very dissatisfied
2 stars = Dissatisfied
3 stars = Neutral
4 stars = Satisfied
5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2026 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
Labs erstellen ein Google Cloud-Projekt und Ressourcen für einen bestimmten Zeitraum
Labs haben ein Zeitlimit und keine Pausenfunktion. Wenn Sie das Lab beenden, müssen Sie von vorne beginnen.
Klicken Sie links oben auf dem Bildschirm auf Lab starten, um zu beginnen
Privates Surfen verwenden
Kopieren Sie den bereitgestellten Nutzernamen und das Passwort für das Lab
Klicken Sie im privaten Modus auf Konsole öffnen
In der Konsole anmelden
Melden Sie sich mit Ihren Lab-Anmeldedaten an. Wenn Sie andere Anmeldedaten verwenden, kann dies zu Fehlern führen oder es fallen Kosten an.
Akzeptieren Sie die Nutzungsbedingungen und überspringen Sie die Seite zur Wiederherstellung der Ressourcen
Klicken Sie erst auf Lab beenden, wenn Sie das Lab abgeschlossen haben oder es neu starten möchten. Andernfalls werden Ihre bisherige Arbeit und das Projekt gelöscht.
Diese Inhalte sind derzeit nicht verfügbar
Bei Verfügbarkeit des Labs benachrichtigen wir Sie per E-Mail
Sehr gut!
Bei Verfügbarkeit kontaktieren wir Sie per E-Mail
Es ist immer nur ein Lab möglich
Bestätigen Sie, dass Sie alle vorhandenen Labs beenden und dieses Lab starten möchten
Privates Surfen für das Lab verwenden
Am besten führen Sie dieses Lab in einem Inkognito- oder privaten Browserfenster aus. So vermeiden Sie Konflikte zwischen Ihrem privaten Konto und dem Teilnehmerkonto, die zusätzliche Kosten für Ihr privates Konto verursachen könnten.
In this lab, you create a deployment using Deployment Manager and use it to maintain a consistent state of your deployment. You will also view resource usage in a VM instance using Google Monitoring.