Skip to content

How to add an SSH Key Pair that can be used with the CLI

Estimated time to read: 2 minutes

In this tutorial, we show you how to add an SSH key pair using the OpenStack CLI tools. Because of design decisions, you can’t share keys with users in OpenStack. This raises the problem that keys created in the dashboard cannot be used with the OpenStack API credentials as used for the command-line interface. If you want to launch instances using the dashboard, check out this tutorial on How to manage your SSH Keys in the Fuga Cloud dashboard.

Prerequisites:

  • A Fuga cloud Account
  • OpenStack Credential
  • OpenStack CLI tools installed
    (this comes in 3 different formats: OpenRC.sh / Clouds.yaml / Dockerfile)

If you have access to OpenStack CLI, you can use the following commands to create key pairs that you can use when deploying instances via the API.

If you don’t have a key pair already, you can create a new one using the following command.

openstack keypair create <Key Pair name>
This creates a new key pair and saves the public pair in OpenStack and returns the private key, please store it in a secure location.

If you already have a private key, you can use this command to create a Public Key in OpenStack

openstack keypair create <Key Pair name> --private <place/of/private-key>
This takes the given private key and creates a public key and saves it in OpenStack

If you want to delete a key pair in Fuga Cloud OpenStack use the following command.

openstack keypair delete <Key Pair name>
If you want to see the current list of registered key pairs, use the following command.
openstack keypair list
This command lists the names and fingerprints of the keys stored in OpenStack.

Conclusion

You have now learned how you can add and delete key pairs using the CLI.