Cloud Shell provides you with command-line access to computing resources hosted on Google Cloud. Cloud Shell is a Debian-based virtual machine with a persistent 5-GB home directory, which makes it easy for you to manage your Google Cloud projects and resources. The gcloud command-line tool and other utilities you need are pre-installed in Cloud Shell, which allows you to get up and running quickly.

In this hands-on lab, you learn how to connect to computing resources hosted on Google Cloud via Cloud Shell with the gcloud tool.

Task 1: Configure your environment

In this section, you learn about aspects of the development environment that you can adjust.

Understanding regions and zones

Certain Google Compute Engine resources live in regions or zones. A region is a specific geographical location where you can run your resources. Each region has one or more zones. For example, the us-central1 region denotes a region in the Central United States that has zones us-central1-aus-central1-bus-central1-c, and us-central1-f. The following image shows zones in their respective regions:

https://cdn.qwiklabs.com/BErmNT8ZIzd5yqxO0lEJj8lAlKT3jKC%2BtI%2Byj3OSKDA%3D

Resources that live in a zone are referred to as zonal resources. Virtual machine instances and persistent disks live in a zone. If you want to attach a persistent disk to a virtual machine instance, both resources must be in the same zone. Similarly, if you want to assign a static IP address to an instance, the instance must be in the same region as the static IP address.

Learn more about regions and zones and see a complete list in Regions and Zones documentation.

To see what your default region and zone settings are, run the following commands:

gcloud config get-value compute/zone
gcloud config get-value compute/region

If the google-compute-default-region or google-compute-default-zone responses are (unset), that means no default zone or region is set.

Identify your default region and zone

  1. Copy your project ID to your clipboard or text editor. The project ID is listed in 2 places:
  1. In Cloud Shell, run the following gcloud command, replacing <your_project_ID> with the project ID you copied:
gcloud compute project-info describe --project <your_project_ID>

Find the default zone and region metadata values in the output. You'll use the zone (google-compute-default-zone) from the output later in this lab.