Create or import key pair

Method URI Description
POST /v2/{tenant_id}/os-keypairs Creates or imports a key pair.

Normal response codes: 200

CAUTION:

Before deleting an account (user), the key pair created by it must be deleted.

Request

This table shows the URI parameters for the create or import keypair request:

Name Type Description
{tenant_id} String Project ID

This table shows the body parameters for the create or import keypair request:

Name Type Description
name string Name to associate with the keypair.
public_key String

(Optional)

Public ssh key to import. If not provided, a key is generated.
availability_zone String

(Optional)

Availability zone for the key pair.

If omitted, the availability zone will be determined automatically from the UUID of the domain that the request execution user belongs to.

Example. Create or import key pair: JSON request


{
	"keypair": {
		"name": "keypair-dab428fe-6186-4a14-b3de-92131f76cd39",
		"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated by Nova",
		"availability_zone": "jp-east-1a"
	}
}       
     

Response

Example. Create or import key pair: JSON response


{
	"keypair": {
		"fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c",
		"name": "keypair-dab428fe-6186-4a14-b3de-92131f76cd39",
		"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated by Nova",
		"user_id": "fake"
	}
}