scottdkier's picture

When launching a new EC2 instance from a backup using the hub, is it possible to select which keypair I want to apply?  It seems to have loaded the various keys from my account to the hub, and then just selects the first/oldest when launching the new instance, or maybe I'm missing something?

I figure I could launch, then save the AMI and re-launch it from the console with new keys, but I'd prefer to use my existing pair.

Forum: 
Jeremy Davis's picture

I only have one key loaded and it works flawlessly.

"SSH Authorized Keys" help (question mark next to it in the Hub under profile):

The SSH key you provide will be added to the authorized keys for the cloud servers you launch. This will allow you to log into your servers with Public Key authentication.

You may specify multiple SSH keys, each on a new line.

...

Considering the wording of that I would assume that if you add multiple keys, then all the keys listed would be added to the instance. But it sounds like that is not the case for you?

I have just done a quick google and it seems that if you have multiple private keys on your local machine then that could be the cause of the issue. If multiple keys are not set up correctly then your local PC will default to just use the first one (which may or may not be the correct one). Obviously if you only have one local private key then that would not explain this...

Can you please double check that you have only one local private key (or have multiple keys configured correctly) and that the specific key you are tring to use in in the list of keys in your profile in the Hub.

Once you have done that (and assuming that it is still an issue) I will escalate this issue to Alon (the Hub Daddy) for him to comment on...

scottdkier's picture

Thanks for your reply.  I'm not sure either and don't have much time for testing right now, but my issue is with the action of launching an instance from a specific backup - in that case I only get the following, without being able to specify SSH key(s). 

 

Jeremy Davis's picture

This may not be immediately obvious and may be a little confusing but this is how it works:

The SSH Authorized Keys (listed on the Hub Profile page) are handled by the Hub (not by AWS). All of these keys should automatically be added to any instance you launch from the Hub. TBH I haven't tested it recently when launching a new instance from a backup, but that's how its meant to work...!

Whereas where you can select a key (when you launch a new server) are keys handled by AWS. From the help on "SSH key-pair" on the launch servers page:

The public part of an SSH key-pair is stored on Amazon EC2 and added to your server's authorized keys on launch. Using your private key, you can then log into your server securely without a password, like this: ssh -i /path/to/keypair-private.key 1.2.3.4 Note: the SSH Public Key in your user profile is also added to the authorized keys.

So you are correct in that there are a lot of options that you cannot select when you launch a new server from a backup (including adding SSH keypairs), however you should (I hope) be able to work around that by adding the key(s) to your Hub profile.

I guess ideally it would be good if you could add a new key on the fly (e.g. like you can when launching a new server) but it currently isn't available. I assume that there is some rationale for doing it the way it is but I'm not 100% sure what that is (I could guess, but I'd rather not...)

Add new comment