create_key_pair¶
Operation¶
create_key_pair
async
¶
create_key_pair(input: CreateKeyPairInput, plugins: list[Plugin] | None = None) -> CreateKeyPairOutput
Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified 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 EC2 User Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
CreateKeyPairInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
CreateKeyPairOutput
|
An instance of |
Input¶
CreateKeyPairInput
dataclass
¶
Bases: _SerdeShape
Dataclass for CreateKeyPairInput structure.
Attributes¶
dry_run
class-attribute
instance-attribute
¶
dry_run: bool | None = ...
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.
key_format
class-attribute
instance-attribute
¶
key_format: str | None = ...
The format of the key pair.
Default: pem
key_name
class-attribute
instance-attribute
¶
key_name: str | None = ...
A unique name for the key pair.
Constraints: Up to 255 ASCII characters
Output¶
CreateKeyPairOutput
dataclass
¶
Bases: _SerdeShape
Describes a key pair.
Attributes¶
key_fingerprint
class-attribute
instance-attribute
¶
key_fingerprint: str | None = ...
-
For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
-
For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8.
key_material
class-attribute
instance-attribute
¶
key_material: str | None = ...
An unencrypted PEM encoded RSA or ED25519 private key.
key_pair_id
class-attribute
instance-attribute
¶
key_pair_id: str | None = ...
The ID of the key pair.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.