title: gcloud compute ssh refuses connection (return code 255)
body: <p>I cannot get ssh access into the vm instance created by Google Cloud command line tool (gcloud).</p>
  
  <p>Symptom:</p>
  
  <pre><code>sudo gcloud compute ssh myuser@ubuntu
  ssh: connect to host 104.155.16.104 port 22: Connection refused
  ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
  </code></pre>
  
  <p>What I did:</p>
  
  <p>1: Verify that firewall is open on port 22</p>
  
  <pre><code>gcloud compute firewall-rules list
  </code></pre>
  
  <p>returned</p>
  
  <pre><code>NAME                    NETWORK  SRC_RANGES    RULES                         SRC_TAGS  TARGET_TAGS
  allow-rstudio           default  0.0.0.0/0     tcp:8787                                allow-rstudio
  default-allow-http      default  0.0.0.0/0     tcp:80                                  http-server
  default-allow-https     default  0.0.0.0/0     tcp:443                                 
  https-server
  default-allow-icmp      default  0.0.0.0/0     icmp
  default-allow-internal  default  10.128.0.0/9  tcp:0-65535,udp:0-65535,icmp
  default-allow-rdp       default  0.0.0.0/0     tcp:3389
  default-allow-ssh       default  0.0.0.0/0     tcp:22
  </code></pre>
  
  <p>2: Renew public key </p>
  
  <pre><code>ssh-keygen -t rsa -f ~/.ssh/google_compute_engine -C myuser
  </code></pre>
  
  <p>3: Update metadata with new public key</p>
  
  <pre><code>sudo gcloud compute ssh myuser@ubuntu
  Updating project ssh metadata...
  Updating project ssh metadata...done.                                                                                                                                     
  Waiting for SSH key to propagate.
  </code></pre>
  
  <p>Then, still the same error message:</p>
  
  <pre><code>ssh: connect to host 35.187.38.82 port 22: Connection refused
  ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
  </code></pre>
  
  <p>I should add that I could access ssh until today, and of course, I did authentication before with
      gcloud auth login</p>
  
  <p>SSH from the Google Cloud web interface works! What is different there?
  Would be grateful for any help!!</p>