Table of Content
Google cloud hands-on guide: Cloud Shell & gcloud
qwiklabs GCP notes.
- Cloud Shell is a Debian-based virtual machine with a persistent 5GB home directory
- gcloud command-line access to computing resources hosted on Google Cloud Platform
cloud shell is a vm with 25G / space, and 5G /home,
google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ df -h Filesystem Size Used Avail Use% Mounted on none 25G 16G 7.6G 68% / tmpfs 853M 0 853M 0% /dev tmpfs 853M 0 853M 0% /sys/fs/cgroup /dev/sdb1 4.8G 11M 4.6G 1% /home /dev/sda1 25G 16G 7.6G 68% /etc/hosts shm 64M 0 64M 0% /dev/shm google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ uname -a Linux cs-6000-devshell-vm-f5a7ad0f-f2f5-403b-a972-a207b06589c8 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64 GNU/Linux
gcloud – google cloud cli
gcloud config list project
google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ gcloud config list project [core] project = qwiklabs-gcp-7546ccf38d44e17f Your active configuration is: [cloudshell-25806]
gcloud help
google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ gcloud -h Usage: gcloud [optional flags]group may be alpha | app | auth | beta | components | compute | config | container | dataflow | dataproc | datastore | debug | deployment-manager | dns | domains | endpoints | firebase | iam | kms | logging | ml | ml-engine | organizations | projects | service-management | services | source | spanner | sql | topic command may be docker | feedback | help | info | init | version For detailed information on this command and its flags, run: gcloud --help same result gcloud config --help gcloud help config
gcloud config list
google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ gcloud config list [component_manager] disable_update_check = True [compute] gce_metadata_read_timeout_sec = 5 [core] account = google150652_student@qwiklabs.net check_gce_metadata = False disable_usage_reporting = False project = qwiklabs-gcp-7546ccf38d44e17f [metrics] environment = devshell Your active configuration is: [cloudshell-25806]
gcloud config list –all
google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ gcloud config list --all [app] cloud_build_timeout (unset) promote_by_default (unset) stop_previous_version (unset) use_runtime_builders (unset) [auth] disable_credentials (unset) [billing] quota_project (unset) [component_manager] additional_repositories (unset) disable_update_check = True [compute] gce_metadata_read_timeout_sec = 5 region (unset) use_new_list_usable_subnets_api (unset) zone (unset) [container] build_timeout (unset) cluster (unset) use_application_default_credentials (unset) use_client_certificate (unset) [core] account = google150652_student@qwiklabs.net check_gce_metadata = False custom_ca_certs_file (unset) default_regional_backend_service (unset) disable_color (unset) disable_prompts (unset) disable_usage_reporting = False log_http (unset) max_log_days (unset) pass_credentials_to_gsutil (unset) project = qwiklabs-gcp-7546ccf38d44e17f show_structured_logs (unset) trace_token (unset) user_output_enabled (unset) verbosity (unset) [dataproc] region (unset) [functions] region (unset) [interactive] bottom_bindings_line (unset) bottom_status_line (unset) completion_menu_lines (unset) context (unset) fixed_prompt_position (unset) help_lines (unset) hidden (unset) justify_bottom_lines (unset) manpage_generator (unset) multi_column_completion_menu (unset) prompt (unset) show_help (unset) suggest (unset) [metrics] environment = devshell [ml_engine] local_python (unset) polling_interval (unset) [proxy] address (unset) password (unset) port (unset) rdns (unset) type (unset) username (unset) [spanner] instance (unset) Your active configuration is: [cloudshell-25806] Use the gsutil tool in Cloud Shell to manage Cloud Storage resources.
gsutil – google storage utility
upload local file to cloud space
google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ gsutil mb gs://myspace-222 Creating gs://myspace-222/... google150652_student@qwiklabs-gcp-7546ccf38d44e17f:~$ gsutil cp test.md gs://myspace-222 Copying file://test.md [Content-Type=application/octet-stream]... - [1 files][ 76.0 B/ 76.0 B] Operation completed over 1 objects/76.0 B.