Key pairs are SSH credentials which are injected into images when they are launched.  Creating a new key pair in Openstack registers the public key and downloads the private key.  In order to connect to any cloud instances you will need to utilize an SSH key pair.  There are two ways to accomplish this:


1. Create the key pair in the Openstack Management Console, or

2. Upload an existing SSH public key to Openstack that you've generated on your personal computer



1. How to create a key pair in Openstack:


The first time you login to the  Openstack Management Console you need to create a key pair so that you'll be able to remotely connect to your instances.  


Click on the "Key Pairs" menu:



Click on the "Create Key Pair" button and name your key pair:



NOTE: you can use many different key pairs on your account, if desired.  You will be able to choose which pair is used when launching an instance.



You will be prompted to download the private key portion of the key pair to your workstation.  


NOTE: It is VERY IMPORTANT to store this key in a safe place as you will need it to access your instances.  Do NOT store these credentials on front end machines of the clusters or shared storage (such as IFS home or project directories or GPFS). They should be treated like ssh private keys and kept very secure. If these credentials were to be compromised, the attacker would gain full access to your cloud account.  Make sure to change the ownership of the file to allow you to read it and no one else!





2. You can upload an existing public key that you've previously created for use in Openstack.  To do this, click on "Import Key Pair" - enter a name for your key pair and paste the contents of your PUBLIC key into the box.  Then click the "Import Key Pair" button



When launching a new instance, select the key pair you'd like to use and once the instance is started, refer to it when logging in on the command line.  

In the first example, you'd login using:

ssh -i testing.pem <username>@<instance_ip>


NOTE: replace <username> with the username on the instance and <instance_ip> with the IP address Openstack has assigned to the instance (you'll see this in the Openstack console)


In the second example, you'd use:

ssh -i testing2.key <username>@<instance_ip>


More information on working with instances can be found in this article