Skip to content

Key pair CLI reference

See https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/keypair.html for a list of commands and more information about each command.

These commands allow you to create, list, show details of, and delete key pairs in your cloud projects. The <keypair_name> in the commands is a placeholder that should be replaced with the actual name of the key pair. When creating a new key pair without specifying a public key, the private key will be displayed in the output and should be saved securely.

List key pairs

Bash
openstack keypair list

Show key pair details

Bash
openstack keypair show <keypair_name>

Create a key pair

Bash
openstack keypair create --public-key <public_key_file> <keypair_name>
  • <public_key_file>: Path to the file containing the public key (optional; if not provided, a new key pair will be generated)

Import a key pair

Bash
openstack keypair create --public-key <public_key_file> <keypair_name>
  • This command is the same as the one for creating a key pair but requires the --public-key option to specify the public key file to import

Delete a key pair

Bash
openstack keypair delete <keypair_name>

Generate a key pair and save private key

Bash
openstack keypair create --private-key <private_key_file> <keypair_name>
  • <private_key_file>: Path to save the generated private key file