Anleitung und Anforderungen für Lab-Einrichtung
Schützen Sie Ihr Konto und Ihren Fortschritt. Verwenden Sie immer den privaten Modus und Lab-Anmeldedaten, um dieses Lab auszuführen.

Accessing the Google Cloud Console and Cloud Shell

Lab 1 Stunde universal_currency_alt 5 Guthabenpunkte show_chart Einsteiger
info Dieses Lab kann KI-Tools enthalten, die den Lernprozess unterstützen.
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 become familiar with Google Cloud's web-based interface. Two integrated environments are available:

  • A GUI environment called the Google Cloud console
  • A command-line interface called Cloud Shell, which has the commands from the Cloud SDK pre-installed

In this course, you use both environments.

You need to know a few things about the Google Cloud console:

  • The Google Cloud console is under continuous development, so the graphical layout occasionally changes. These changes are often made to accommodate new Google Cloud features or changes in the technology, resulting in a slightly different workflow.
  • You can perform most common Google Cloud actions in the Google Cloud console. Sometimes new features are implemented in the Cloud SDK before they are made available in the Google Cloud console.
  • The Google Cloud console is extremely fast for some activities. The Google Cloud console can perform multiple actions on your behalf that might require many command-line actions.
  • The commands in the Cloud SDK are valuable tools for automation.

Objectives

In this lab, you learn how to perform the following tasks:

  • Learn how to access the Google Cloud console and Cloud Shell
  • Become familiar with the Google Cloud console
  • Become familiar with Cloud Shell features, including the Cloud Shell Editor
  • Use the Google Cloud console and Cloud Shell to create buckets and VMs
  • Configure IAM permissions
  • Perform other commands in Cloud Shell

Lab Setup

Access your lab

For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To view a menu with a list of Google Cloud products and services, click the Navigation menu at the top-left, or type the service or product name in the Search field. Navigation menu icon

After you complete the initial sign-in steps, the project dashboard appears.

Google Cloud Project Dashboard

Task 1. Explore the Google Cloud console

In this task, you wll explore the Google Cloud console interface. You learn how to navigate to different services and identify key details of a running Virtual Machine (VM).

Create a virtual machine (VM) instance

Google Compute Engine offers virtual machines running in Google's datacenters and on its network as a service. Google Kubernetes Engine makes use of Compute Engine as a component of its architecture. For this reason, it's helpful to learn a bit about Compute Engine before learning about Google Kubernetes Engine.

  1. In the Navigation menu (Navigation menu icon), click Compute Engine > VM instances.
  2. Click Create instance.
  3. For Name, type first-vm as the name of your instance.
  4. For Region, select .
  5. For Zone, select .
  6. For Machine type, examine the options.
Note: The machine type menu lists the number of virtual CPUs, the amount of memory, and a symbolic name such as e2-medium. The symbolic name is the parameter you use to select the machine type when using the gcloud command to create a VM. To the right of the region, zone, and machine type is a per-month estimated cost.
  1. To see the breakdown of estimated costs, view Monthly estimate to the right of the Machine type list.
  2. For Machine type, click Standard > e2-standard-2.

How did the cost change?

  1. For Machine type, click Shared-core > e2-micro.

The micro type is a shared-core VM that is inexpensive.

  1. From the left pane navigate to Networking, then under Firewall select Allow HTTP traffic.
  2. Leave the remaining settings as their defaults, and click Create.

Wait until the new VM is created.

Explore the VM details

  1. On the VM instances page, click the name of your VM: first-vm.
  2. In Machine configuration, notice the value of CPU platform, notice the value.
  3. Click on the pencil icon on the top to edit the first-vm instance.
Note: You can't change the machine type, the CPU platform, or the zone of a running Google Cloud VM. You can add network tags and allow specific network traffic from the internet through firewalls.

Some properties of a VM are integral to the VM and are established when the VM is created. They cannot be changed. Other properties can be edited. For example, you can add disks, and you can determine whether the boot disk is deleted when the instance is deleted.
  1. Scroll down to the Management section and examine availability policies.

  2. Click Cancel.

Create an IAM service account

An IAM service account is a special type of Google account that belongs to an application or a virtual machine, instead of to an individual end user.

  1. In the Navigation menu, click IAM & admin > Service accounts.
  2. Click + Create service account.
  3. On the Service account details page, specify the Service account name as test-service-account
  4. Click Create and continue.
  5. On the Grant this service account access to project page, specify the role as Basic > Editor.
  6. Click Continue.
  7. Click Done. Verify that see the test account test-service-account@qwiklabs-gpc-xx-xxxxxxxxxxx.gserviceaccount.com listed.

Click Check my progress to verify the objective. Create a VM instance with necessary firewall rule, and an IAM service account

Task 2. Explore Cloud Shell

In this task, you activate Cloud Shell, a pre-configured command-line environment. You verify that it is automatically authenticated and ready to use.

Cloud Shell provides you with command-line access to your cloud resources directly from your browser. With Cloud Shell, Cloud SDK command-line tools such as gcloud are always available, up to date, and fully authenticated.

Cloud Shell provides the following features and capabilities:

  • Temporary Compute Engine VM
  • Command-line access to the instance through a browser
  • 5 GB of persistent disk storage ($HOME dir)
  • Preinstalled Cloud SDK and other tools
  • gcloud: for working with Compute Engine, Google Kubernetes Engine (GKE), and many Google Cloud services
  • gcloud storage and gsutil: for working with Cloud Storage
  • kubectl: for working with GKE and Kubernetes
  • bq: for working with BigQuery
  • Language support for Java, Go, Python, Node.js, PHP, and Ruby
  • Web preview functionality
  • Built-in authorization for access to resources and instances

After one hour of inactivity, the Cloud Shell instance is recycled. Only the /home directory persists. Any changes made to the system configuration, including environment variables, are lost between sessions.

Open Cloud Shell and explore its features

  1. On the Google Cloud console title bar, click Activate Cloud Shell (Cloud Shell icon).
  2. When prompted, click Continue. If prompted click Authorize.

Cloud Shell opens at the bottom of the Google Cloud console window.

The following icons are on the far right of Cloud Shell toolbar:

  • Hide/Restore: This icon hides and restores the window, giving you full access to the Google Cloud console without closing Cloud Shell.
  • Open in new window: Having Cloud Shell at the bottom of the Google Cloud console is useful when you are issuing individual commands. But when you edit files or want to see the full output of a command, clicking this icon displays Cloud Shell in a full-sized terminal window.
  • Close all tabs: This icon closes Cloud Shell. Every time you close Cloud Shell, the virtual machine is recycled and all machine context is lost. However, data that you stored in your home directory is still available to you the next time you start Cloud Shell.

Use Cloud Shell to list the credentials stored on the system

In Cloud Shell, use the following command to list the accounts whose credentials are stored on the system.

  1. Run the following command to list the active account:
gcloud auth list
  1. Verify that the output displays your lab student email address as the active account.

Verify Your Project

Cloud Shell also automatically sets your environment to the current project ID.

  1. Run the following command to verify the project configuration:
gcloud config list project
  1. Confirm that the output matches the Project ID displayed in the lab connection details panel.

  2. Run the following command to print the Google Cloud Project ID that the current Cloud Shell session is associated with:

echo $DEVSHELL_PROJECT_ID

This variable allows you to run scripts without manually typing the project ID every time.

  1. Run the following command to verify your current directory:
pwd

Your student directory is listed.

  1. Run the following command to get some help about the command you will use in the next task:
gcloud storage buckets create --help

Use the arrow keys, or press enter or return to view more information.

  1. Press CTRL-C to exit.

Task 3. Create Cloud Storage Buckets

In this task, you create Cloud Storage buckets and manage objects using both the Cloud Console (GUI) and Cloud Shell (CLI). You create buckets, copy a file between them using the command line, and verify the changes in the Console. Finally, you configure Identity and Access Management (IAM) permissions to make a bucket publicly accessible and view your file via a web browser.

This demonstrates that regardless of which tool you use, you are interacting with the same Google Cloud resources.

  1. In the Google Cloud console, in the Navigation menu(Navigation menu icon), click Cloud Storage > Buckets.

  2. Click Create bucket.

  3. For Name, type -bucket1

Note: Bucket names must be unique across all of Google Cloud, not just your project. A good practice is to use your Project ID as a prefix
  1. Click Continue.

  2. For Location Type, select Region and select from the dropdown.

  3. Click Continue.

  4. In Choose how to store your data, accept the defaults and click Continue.

  5. In Choose how to control access to objects, deselect Enforce public access prevention on this bucket,

  6. For Access control, ensure Uniform is selected.

  7. Click Continue, and then click Create.

You have now created a storage bucket using the graphical interface.

Note: The Google Cloud console has a Notifications (notifications icon) icon. Feedback from the underlying commands is sometimes provided there. You can click the icon to check the notifications for additional information and history.

Verify the bucket in Cloud Shell

Now, you will use Cloud Shell to confirm that the bucket exists.

  1. Return to your Cloud Shell terminal window.

  2. Run the following command to list the storage buckets in your project:

gcloud storage buckets list
  1. You should see the name of the bucket that you just created, -bucket1

Create a bucket using Cloud Shell

Next, you will perform the same action—creating a bucket—using the command line.

  1. In Cloud Shell, use the gcloud storage command to create a bucket:
gcloud storage buckets create gs://{{{project_0.project_id | Project ID}}}-bucket2 --location={{{project_0.default_region | REGION}}}
  1. Run the following command to verify that you see both storage buckets in your project:
gcloud storage buckets list

Copy a file to the Cloud Storage bucket

  1. Copy a picture of a cat from a Google-provided Cloud Storage bucket to your Cloud Shell:
gcloud storage cp gs://cloud-training/ak8s/cat.jpg cat.jpg
  1. Copy the file into the first bucket that you created earlier:
gcloud storage cp cat.jpg gs://{{{project_0.project_id | Project ID}}}-bucket1
  1. Copy the file from the first bucket into the second bucket:
gcloud storage cp gs://{{{project_0.project_id | Project ID}}}-bucket1/cat.jpg gs://{{{project_0.project_id | Project ID}}}-bucket2/cat.jpg
  1. In the Google Cloud console, in the Navigation menu(Navigation menu icon), click Cloud Storage > Buckets, select both the buckets that you created, and verify that both contain the cat.jpg file.
Note: You may have to click Refresh to see the 2nd bucket.
  1. Select the first storage bucket, -bucket1 that you created. Notice that the cat.jpg does not have Public access.

  2. Click the Permissions tab.

  3. In View by principals, click Grant access.

  4. In New principals, type allUsers.

  5. For Assign Roles, in Role, select Storage Object Viewer.

  6. Click Save.

  7. In the make resource public dialog box, click Allow Public Access.

  8. Click Back to parent page to return to the main screen.

  9. Select the first storage bucket, -bucket1 that you created.

  10. Verify that Public access for the bucket is now shown as, Access granted to public principals.

  11. Click Copy URL to copy the link to the cat image.

  12. Open a new incognito browser tab and paste the link into its address bar. You will see a picture of a cat. Leave this browser tab open.

Click Check my progress to verify the objective. Create Cloud Storage Buckets

Task 4. Explore the Cloud Shell Editor

In this task, you explore using the Cloud Shell code editor.

Open the Cloud Shell Editor

  1. In Cloud Shell, click the Open Editor icon (Cloud Shell editor icon).

  2. In Cloud Shell Editor, click on File > Open Folder.

Cloud Shell Editor menu

  1. Click Ok.

The folder opens and displays a list of files and directories in the left pane.

  1. Click Open Terminal, and in Cloud Shell, execute the following command to clone a git repository:
git clone https://github.com/googlecodelabs/orchestrate-with-kubernetes.git

The orchestrate-with-kubernetes folder appears in the left pane of the Cloud Shell Editor window.

  1. In Cloud Shell, execute the following command to create a test directory:
mkdir test

The test folder now appears in the left pane of the Cloud Shell Editor window.

  1. In the Cloud Shell Editor, click the arrow to the left of orchestrate-with-kubernetes to expand the folder.

orchestrate-with-kubernetes folder

  1. In the left pane, click the cleanup.sh file to open it in the right pane of the Cloud Shell Editor window.

  2. Add the following text as the last line of the cleanup.sh file:

echo Finished cleanup! Note: No action is necessary to save your work.
  1. In Cloud Shell, execute the following commands to change directory and display the contents of cleanup.sh:
cd orchestrate-with-kubernetes cat cleanup.sh
  1. Verify that the output of cat cleanup.sh includes the line of text that you added.

  2. In the Cloud Shell code editor, right click the orchestrate-with-kubernetes folder, and select New File.

Note: If you are prompted with a pop-up to "see text and images copied to the clipboard", click Allow.
  1. Name the file index.html.

  2. Click Save.

  3. In the right hand pane, paste in this HTML text:

<html><head><title>Cat</title></head> <body> <h1>Cat</h1> <img src="REPLACE_WITH_CAT_URL"> </body></html> Note: Use your local computer's keyboard shortcut to paste: `Cmd-V` for a Mac, `Ctrl-V` for a Windows or Linux machine.
  1. Replace the string REPLACE_WITH_CAT_URL with the URL of the cat image from an earlier task. The URL will look like this:
https://storage.googleapis.com/qwiklabs-Google Cloud-1aeffbc5d0acb416/cat.jpg
  1. In the Navigation menu (Navigation menu icon), click Compute Engine > VM instances.

  2. In the row for your first-vm, click the SSH button.

  3. In the SSH login window that opens on your VM, install the nginx Web server:

sudo apt-get remove -y --purge man-db sudo touch /var/lib/man-db/auto-update sudo apt-get update sudo apt-get install nginx Note: It may take few minutes to complete the process. If prompted, click Y to continue.
  1. In your Cloud Shell window, copy the HTML file you created using the Cloud Shell Editor to your virtual machine:
gcloud compute scp index.html first-vm:index.html --zone={{{project_0.default_zone | "ZONE"}}} Note: If you are prompted whether to add a host key to your list of known hosts, answer Y. Note: If you are prompted to enter a passphrase, press the ENTER key to respond with an empty passphrase. Press the ENTER key again when prompted to confirm the empty passphrase.
  1. In the SSH login window for your VM, copy the HTML file from your home directory to the document root of the nginx web server:
sudo cp index.html /var/www/html

Click Check my progress to verify the objective. Install the nginx web server and customize the welcome page

  1. In the Navigation menu (Navigation menu icon), click Compute Engine > VM instances.

  2. Click the link in the External IP column for your first-vm. If you see the message that the site does not support a secure connection, click Continue to site.

    A new browser tab opens with a webpage that contains the cat image.

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 2025 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.

Vorbereitung

  1. Labs erstellen ein Google Cloud-Projekt und Ressourcen für einen bestimmten Zeitraum
  2. Labs haben ein Zeitlimit und keine Pausenfunktion. Wenn Sie das Lab beenden, müssen Sie von vorne beginnen.
  3. Klicken Sie links oben auf dem Bildschirm auf Lab starten, um zu beginnen

Privates Surfen verwenden

  1. Kopieren Sie den bereitgestellten Nutzernamen und das Passwort für das Lab
  2. Klicken Sie im privaten Modus auf Konsole öffnen

In der Konsole anmelden

  1. Melden Sie sich mit Ihren Lab-Anmeldedaten an. Wenn Sie andere Anmeldedaten verwenden, kann dies zu Fehlern führen oder es fallen Kosten an.
  2. Akzeptieren Sie die Nutzungsbedingungen und überspringen Sie die Seite zur Wiederherstellung der Ressourcen
  3. 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

Nutzen Sie den privaten oder Inkognitomodus, um dieses Lab durchzuführen. So wird verhindert, dass es zu Konflikten zwischen Ihrem persönlichen Konto und dem Teilnehmerkonto kommt und zusätzliche Gebühren für Ihr persönliches Konto erhoben werden.