How to SSH into RancherOS instances created in AWS via the UI

I created a couple host instances in EC2 using the UI, and I’d like to SSH into them.

Looking at the instances in EC2, each of the hosts were created with their own key pair (named after the host name).
However, I don’t have those keys to ssh into them.

I’m not sure where to find those keys or where/how I can connect to them.

I tried on the host server which is running rancher/server
I tried from the rancher/server container via docker exec

I guess I must be missing something obvious?
Could the UI ask for the key pair name to use when creating instances in AWS, instead of creating a new one each time?

In the UI on the host there is a Machine Config action that will give you the key pair (among other things):

There is not an option in docker-machine to use an existing key pair. You need to provide it the private key somehow because it uses it to SSH to the machine and install Docker after the Instance is created.


Thanks! I can indeed connect to the hosts after downloading and using the key from config tarball.

Could the rancher agent install a key pair (if specified) as part of it’s init process?

That is possible but not implemented; docker-machine would still have already added a keypair and doesn’t clean it up until the host is deleted.

Just FYI unless you are specifically setting a RancherOS AMI ID at the end of the Add Host steps, you are deploying Ubuntu instances (not RancherOS). It’s the default for docker-machine and we haven’t added friendly options to change it (yet).

What was the actual file used to login to aws instance, I tried key and server-key and they didn’t work.

Use the id_rsa file like this. (Note: do not use the file)

ssh -i id_rsa rancher@$IP_ADDR

replace the user ‘rancher’ with the appropriate user (‘ubuntu’ for ubuntu etc.), if you’re using an OS that is not RancherOS.

replace $IP_ADDR with the ip address of the host

1 Like

Thank you for the help.