Reputation: 2642
I would like to use autossh instead of the ssh command run by google cloud while doing
gcloud compute ssh --zone myzone --project myproject mymachine
What is the command line to replace it?
Upvotes: 0
Views: 433
Reputation: 2642
Here is the two commands that allow you to use autossh:
gcloud compute config-ssh
autossh -M9042 mymachine.myzone.myproject
In my opinion, this is the easiest way to do it. The first line export the ssh key and configuration of your machines, and the second just use this alias.
This also allow you to use the shortcut mymachine.myzone.myproject
for scp, ssh, and all ssh related tools. Indeed, the list of your machines are exported in your ~/.ssh/config
.
This is a list of aliases you can also configure by hand.
For more information on gcloud's config-ssh
, you can refer to the official documentation.
Notice that some shell environment will provide you with ssh command autocompletion, which is really helpful when it comme to remembering the name of your machines. Here is a reference for zsh.
Upvotes: 1