Gsutil
From charlesreid1
gsutil
gsutil is how you interact with google cloud products from the command line
For the purposes of course 1 module 2, this is how you interact with the google cloud filesystem
Links:
- Link to getting the google cloud sdk: https://cloud.google.com/sdk/docs/
- Link to gsutil documentation: https://cloud.google.com/storage/docs/gsutil
Following instructions, I start by running the bash script to install stuff on the path, but only some of these are actually installed:
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Components │ ├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤ │ Status │ Name │ ID │ Size │ ├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤ │ Not Installed │ App Engine Go Extensions │ app-engine-go │ 97.7 MiB │ │ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.0 MiB │ │ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │ │ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │ │ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │ │ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │ │ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │ │ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │ │ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │ │ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │ │ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │ │ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │ │ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 130.9 MiB │ │ Not Installed │ gcloud app PHP Extensions │ app-engine-php │ 21.9 MiB │ │ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.3 MiB │ │ Not Installed │ kubectl │ kubectl │ 15.9 MiB │ │ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │ │ Installed │ Cloud SDK Core Libraries │ core │ 6.7 MiB │ │ Installed │ Cloud Storage Command Line Tool │ gsutil │ 3.0 MiB │ └───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘ To install or remove components at your current SDK version [172.0.0], run: $ gcloud components install COMPONENT_ID $ gcloud components remove COMPONENT_ID To update your SDK installation to the latest version [172.0.0], run: $ gcloud components update
Next, we initialize the Google Cloud SDK by logging in and configuring it:
$ ./google-cloud-sdk/bin/gcloud init Welcome! This command will take you through the configuration of gcloud. Your current configuration has been set to: [default] You can skip diagnostics next time by using the following flag: gcloud init --skip-diagnostics Network diagnostic detects and fixes local network connection issues. Checking network connection...done. Reachability Check passed. Network diagnostic (1/1 checks) passed. You must log in to continue. Would you like to log in (Y/n)? y
This opens the browser to a Google login page. Log in with your account. This will show you the authentication success page, along with links to documentation for the various gsutil sub-commands.
We're focusing on cloud storage for now.
Next, back at the command line, you'll be asked which project you'd like to use. Note that projects are listed by ID, and not by name.
It will ask you if you want to set default settings. Note that what this is doing is creating a dot file with default configuration settings on your local machine, so that when you (e.g.) request a new compute instance, you won't need to specify details like zone or region each time.
Created a default .boto configuration file at [/Users/charles/.boto]. See this file and [https://cloud.google.com/storage/docs/gsutil/commands/config] for more information about configuring Google Cloud Storage. Your Google Cloud SDK is configured and ready to use! * Commands that require authentication will use <my-email-address> by default * Commands will reference project `quiet-era-180418` by default * Compute Engine commands will use region `us-west1` by default * Compute Engine commands will use zone `us-west1-c` by default Run `gcloud help config` to learn how to change individual settings This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects. Run `gcloud topic configurations` to learn more. Some things to try next: * Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command. * Run `gcloud topic -h` to learn about advanced features of the SDK like arg files and output formatting