Setting up gcloud

Once servers are created, we can connect to them on Google Cloud using gcloud and ssh using our terminal.

  • Click here to get instructions to setup gcloud
  • We will be using Debian/Ubuntu instructions (on Windows System).
  • Follow the instructions on the page. No need to install additional packages.
  • Make sure to run gcloud init
  • Use gcloud command from one of the hosts and connect to the host. It will generate new key with name google_compute_engine under ~/.ssh
  • We can use this to connect to the servers directly using ssh with external ip
  • For the first server set external ip as static
    • Go to Instance -> expand menu -> View Network Details
    • It will take us to VPC network
    • Click on External IP addresses
    • Change type for the first server (bigdataserver-1) from Ephemeral to Static
    • Provide Name and Description (bigdataserver-1)
    • Click on Reserve
    • There is nominal cost associated with the static ip
  • Make sure to copy private key on to the first server from which you want to manage all the other servers using meaningful names such as bigdataserver-2.
    • scp -i ~/.ssh/google_compute_engine ~/.ssh/google_compute_engine dgadiraju@35.196.243.128:~/.ssh
    • Once the private key is copied, we should be able to connect from bigdataserver-1 using command like this – ssh -i ~/ssh/google_compute_engine bigdataserver-2

Share this post