Creating and importing a Key pair using the OpenStack CLI

Overview

The OpenStack CLI lets you generate a new key pair or import an existing public key for use with DreamCompute. This procedure assumes you've already installed the OpenStack CLI on your computer:

How do I create a key pair and add it to DreamCompute?

To generate a key pair, run the following command.

[user@localhost]$ openstack keypair create KEY_NAME > MY_KEY.pem

This command generates a key pair using your specified names and writes them to a .pem file. The Key Pair is then registered within your DreamCompute dashboard. You can view the list on the Compute > Key Pairs page. You can also view is my running the following command:

[user@localhost]$ openstack keypair list

How do I import a previously existing key pair?

If you have already generated a Key Pair on your Linux or Mac computer, the public key is most likely named id_rsa.pub and located in the directory: ~/.ssh/. Run the following command to generate the new Key Pair in your DreamCompute dashboard.

The backslash character \ is used when entering a long command. When you enter the \, the terminal command continues to the next line until you finish entering it.

You could also remove the \ character and put every parameter into a single line.

[user@localhost]$ openstack keypair create --public-key \
~/.ssh/id_rsa.pub MY_KEY_NAME
+-------------+-------------------------------------------------+
| Field       | Value                                           |
+-------------+-------------------------------------------------+
| fingerprint | f2:fc:4f:ca:1c:b7:ba:43:1f:b8:e5:fc:63:84:79:13 |
| name        | My_KEY_NAME                                     |
| user_id     | 29815315c4ce4d48a27e767a63eb8320                |
+-------------+-------------------------------------------------+

The Key Pair is then registered within your DreamCompute dashboard. You can view the list on the Compute > Key Pairs page. It names the new Key Pair the name that you specify for MY_KEY_NAME. To ensure that the key pair has been successfully imported, run the following command to list key pairs:

[user@localhost]$ openstack keypair list

This form is only for article feedback. If you require assistance, please contact support. Do not include passwords, account numbers, or other private account details.

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?