Skip to content

/AWS1/CL_EC2=>CREATEKEYPAIR()

About CreateKeyPair

Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified PEM or PPK format. Amazon EC2 stores the public key and displays the private key for you to save to a file. The private key is returned as an unencrypted PEM encoded PKCS#1 private key or an unencrypted PPK formatted private key for use with PuTTY. If a key with the specified name already exists, Amazon EC2 returns an error.

The key pair returned to you is available only in the Amazon Web Services Region in which you create it. If you prefer, you can create your own key pair using a third-party tool and upload it to any Region using ImportKeyPair.

You can have up to 5,000 key pairs per Amazon Web Services Region.

For more information, see Amazon EC2 key pairs in the Amazon Elastic Compute Cloud User Guide.

Method Signature

IMPORTING

Required arguments:

IV_KEYNAME TYPE /AWS1/EC2STRING /AWS1/EC2STRING

A unique name for the key pair.

Constraints: Up to 255 ASCII characters

Optional arguments:

IV_DRYRUN TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

IV_KEYTYPE TYPE /AWS1/EC2KEYTYPE /AWS1/EC2KEYTYPE

The type of key pair. Note that ED25519 keys are not supported for Windows instances.

Default: rsa

IT_TAGSPECIFICATIONS TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST

The tags to apply to the new key pair.

IV_KEYFORMAT TYPE /AWS1/EC2KEYFORMAT /AWS1/EC2KEYFORMAT

The format of the key pair.

Default: pem

RETURNING

OO_OUTPUT TYPE REF TO /AWS1/CL_EC2KEYPAIR /AWS1/CL_EC2KEYPAIR