On Thu, Apr 25, 2013 at 8:34 AM, Anne Gentle <a...@openstack.org> wrote: > Can you better explain to Jamie how keypair injection works and what Compute > API commands correspond with the Dashboard creation and association of > keypairs?
I'll take a stab at the basic use of keypairs from the Nova CLI. I don't think Horizon does anything drastically different than this. DevStack has an example in https://github.com/openstack-dev/devstack/blob/master/exercises/boot_from_volume.sh that may be useful. Lines 123-129 demonstrate removing an old keypair and adding a new one with the same name. (In the DevStack case, a new keypair is generated on every run, this is not how things normally work, hence the delete.) This shows how Nova will generate the pair and return the private key as the output. You must capture it then, there is no way to get it later. Line 161 shows how to use it during the server boot process. The other way is to use existing ssh keypairs and is how I do things in my own scripts. Add an existing ssh public key to Nova (set KEYNAME to something unique, I often use `hostname`): # ensure keypair is present if ! nova keypair-list | grep -q $KEYNAME; then nova keypair-add --pub_key=$HOME/.ssh/id_rsa.pub $KEYNAME echo "Added keypair for $KEYNAME" fi KEY="--key-name=$KEYNAME" Then, later in the nova boot command: nova boot ... $KEY ... servername In either case you should be able to ssh directly into the instance. In the first case (Nova generating the keypair) remember to tell ssh to use the private file with -i <private-key-file>. dt -- Dean Troyer dtro...@gmail.com _______________________________________________ Mailing list: https://launchpad.net/~openstack Post to : openstack@lists.launchpad.net Unsubscribe : https://launchpad.net/~openstack More help : https://help.launchpad.net/ListHelp