Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Last active July 31, 2018 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/494cd3d5467843b37c227de264741cab to your computer and use it in GitHub Desktop.
Save jpluimers/494cd3d5467843b37c227de264741cab to your computer and use it in GitHub Desktop.
Using homebrew to install the console client to access Google Cloud Shell
$ brew install caskroom/cask/google-cloud-sdk
==> brew cask install caskroom/cask/google-cloud-sdk 
==> Caveats
google-cloud-sdk is installed at /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk. Add your profile:

  for bash users
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc'
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc'

  for zsh users
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'

==> Satisfying dependencies
==> Downloading https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
######################################################################## 100.0%
==> No checksum defined for Cask google-cloud-sdk, skipping verification
==> Installing Cask google-cloud-sdk
==> Running installer script 'google-cloud-sdk/install.sh'
==> Welcome to the Google Cloud SDK!
==> 
==> 
==> Your current Cloud SDK version is: 195.0.0
==> Installing components from version: 195.0.0
==> 
==> +----------------------------------------------------------------------------+
==> |                    These components will be installed.                     |
==> +-----------------------------------------------------+------------+---------+
==> |                         Name                        |  Version   |   Size  |
==> +-----------------------------------------------------+------------+---------+
==> | BigQuery Command Line Tool                          |     2.0.30 | < 1 MiB |
==> | BigQuery Command Line Tool (Platform Specific)      |     2.0.26 | < 1 MiB |
==> | Cloud SDK Core Libraries (Platform Specific)        | 2018.03.16 | < 1 MiB |
==> | Cloud Storage Command Line Tool                     |       4.29 | 3.4 MiB |
==> | Cloud Storage Command Line Tool (Platform Specific) |       4.27 | < 1 MiB |
==> | Default set of gcloud commands                      |            |         |
==> | gcloud cli dependencies                             | 2017.10.20 | 1.4 MiB |
==> +-----------------------------------------------------+------------+---------+
==> 
==> For the latest full release notes, please visit:
==>   https://cloud.google.com/sdk/release_notes
==> 
==> #============================================================#
==> #= Creating update staging area                             =#
==> #==================
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> #
==> #= Installing: BigQuery Command Line Tool                   =#
==> #
==> =
==> ==
==> ==
==> ====
==> ==
==> ===
==> ==
==> ==
==> ==
==> ===
==> =
==> ===
==> =
==> ==
==> =
==> =
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> ==
==> =
==> =#
==> #= Installing: BigQuery Command Line Tool (Platform Spec... =#
==> #
==> ==============================
==> ==============================#
==> #= Installing: Cloud SDK Core Libraries (Platform Specific) =#
==> #
==> ==============================
==> ==============================#
==> #= Installing: Cloud Storage Command Line Tool              =#
==> #
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> #
==> #= Installing: Cloud Storage Command Line Tool (Platform... =#
==> #
==> ==============================
==> ==============================#
==> #= Installing: Default set of gcloud commands               =#
==> #============================================================#
==> #= Installing: gcloud cli dependencies                      =#
==> #
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> =
==> ==========
==> =========
==> ==
==> =
==> =====
==> ==#
==> #= Creating backup and activating new installation          =#
==> #============================================================#
==> 
==> Performing post processing steps...
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> .
==> done.
==> 
==> 
==> This will install all the core command line tools necessary for working with
==> the Google Cloud Platform.
==> 
==> Update done!
==> 
==> ==> Source [/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> ==> Source [/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to yo
==> 
==> For more information on how to get started, please visit:
==>   https://cloud.google.com/sdk/docs/quickstarts
==> 
==> 
==> Linking Binary 'bq' to '/usr/local/bin/bq'.
==> Linking Binary 'gcloud' to '/usr/local/bin/gcloud'.
==> Linking Binary 'git-credential-gcloud.sh' to '/usr/local/bin/git-credential-gcloud'.
==> Linking Binary 'gsutil' to '/usr/local/bin/gsutil'.
🍺  google-cloud-sdk was successfully installed!
$ gcloud alpha
You do not currently have this command group installed.  Using it 
requires the installation of components: [alpha]


Your current Cloud SDK version is: 195.0.0
Installing components from version: 195.0.0

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     These components will be installed.      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚          Name         β”‚  Version   β”‚   Size  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ gcloud Alpha Commands β”‚ 2017.09.15 β”‚ < 1 MiB β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  Y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud Alpha Commands                        ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Performing post processing steps...done.                                                                                                                       

Update done!

Restarting command:
  $ gcloud alpha

ERROR: (gcloud.alpha) Command name argument expected.
Usage: gcloud alpha [optional flags] <group | command>
  group may be           app | auth | billing | cloud-shell | compute | config |
                         container | dataflow | deployment-manager | emulators |
                         endpoints | firebase | functions | genomics | iot |
                         kms | ml | ml-engine | monitoring | organizations |
                         projects | pubsub | resource-manager | resources |
                         scheduler | services | source | spanner | tasks
  command may be         init | interactive | search-help

For detailed information on this command and its flags, run:
  gcloud alpha --help
$ gcloud alpha cloud-shell ssh
ERROR: (gcloud.alpha.cloud-shell.ssh) You do not currently have an active account selected.
Please run:

  $ gcloud auth login

to obtain new credentials, or if you have already logged in with a
different account:

  $ gcloud config set account ACCOUNT

to select an already authenticated account to use.

Console starting step:

$ gcloud auth login
Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&access_type=offline


WARNING: `gcloud auth login` no longer writes application default credentials.
If you need to use ADC, see:
  gcloud auth application-default --help

Web steps:

  1. Select an account
  2. Confirm the access level
  3. At success you end up at https://cloud.google.com/sdk/auth_success

Console finishing when the success page displayed:

You are now logged in as [jeroen.pluimers.com@gmail.com].
Your current project is [None].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID
$ gcloud alpha cloud-shell ssh
WARNING: The public SSH key file for gcloud does not exist.
WARNING: The private SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/jeroenp/.ssh/google_compute_engine.
Your public key has been saved in /Users/jeroenp/.ssh/google_compute_engine.pub.
The key fingerprint is:
SHA256:
........................................... jeroenp@RMBPro1TBJWP.local
The key's randomart image is:
+---[RSA 2048]----+
...................
+----[SHA256]-----+
ERROR: (gcloud.alpha.cloud-shell.ssh) PERMISSION_DENIED: Cloud Shell API has not been used in project google.com:cloudsdktool before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudshell.googleapis.com/overview?project=google.com:cloudsdktool then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
- '@type': type.googleapis.com/google.rpc.Help
  links:
  - description: Google developers console API activation
    url: https://console.developers.google.com/apis/api/cloudshell.googleapis.com/overview?project=google.com:cloudsdktool

The problem is that the URL returns a failure so it cannot be used to enable the API:

https://console.developers.google.com/apis/api/cloudshell.googleapis.com/overview?project=google.com:cloudsdktool -> The API "cloudshell.googleapis.com" doesn't exist or you don't have permission to access it

The API "cloudshell.googleapis.com" doesn't exist or you don't have permission to access it

@jpluimers
Copy link
Author

@jpluimers
Copy link
Author

@KharmaScribbles
Copy link

KharmaScribbles commented Jul 31, 2018

Select/Enable the correct project both in the GUI and console..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment