-2

I have migrated an EC2 instance (amazon linux) to Google cloud (ubuntu 18.04) using cloud endure. But I am not able to ssh into google cloud VM. I dont have EC2 instance anymore. How can I access the Google cloud VM ? Error message:

ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255]
sau
  • 1,316
  • 4
  • 16
  • 37

2 Answers2

0

using gcloud command you can config your SSH

gcloud compute config-ssh

for more details on config-ssh ref : Link

divyang4481
  • 1,584
  • 16
  • 32
  • Tried this. N0 success. Keep getting Permission denied (publickey) – sau Dec 31 '19 at 08:09
  • there is issue with key in ~/.ssh/authorized_keys , you can do serial port login in machine to see more details and log https://cloud.google.com/compute/docs/instances/interacting-with-serial-console – divyang4481 Dec 31 '19 at 09:06
0

If the gcloud compute config-ssh doesn't work check the firewall rules for your machine; find the VPC it's in and make sure port 22 is open - it may happen it's blocked.

If you're not sure if SSH can come through create a rule for it.

Very similar issue was also discussed in this topic on StackOverflow which might help you.

You can (to be absolutely sure SSH traffic is allowed to your VM) set up a startup script for it: edit the VM in question and find "Custom Metadata" section and click "Add Item", next type startup-script as a key and the command sudo ufw allow ssh in the "value" field.

Having the SSH traffic enabled in the GCP firewall and the VM itself you should be able to log in.

Wojtek_B
  • 4,245
  • 1
  • 7
  • 21