Skip to content

EC2  >  Operations  >  import_key_pair

import_key_pair

Operation

import_key_pair async

import_key_pair(input: ImportKeyPairInput, plugins: list[Plugin] | None = None) -> ImportKeyPairOutput

Imports the public key from an RSA or ED25519 key pair that you created using a third-party tool. You give Amazon Web Services only the public key. The private key is never transferred between you and Amazon Web Services.

For more information about the requirements for importing a key pair, see Create a key pair and import the public key to Amazon EC2 in the Amazon EC2 User Guide.

Parameters:

Name Type Description Default
input ImportKeyPairInput

An instance of ImportKeyPairInput.

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
ImportKeyPairOutput

An instance of ImportKeyPairOutput.

Input

ImportKeyPairInput dataclass

Bases: _SerdeShape

Dataclass for ImportKeyPairInput 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_name class-attribute instance-attribute
key_name: str | None = ...

A unique name for the key pair.

public_key_material class-attribute instance-attribute
public_key_material: bytes | None = ...

The public key.

tag_specifications class-attribute instance-attribute
tag_specifications: list[TagSpecification] | None = ...

The tags to apply to the imported key pair.

Output

ImportKeyPairOutput dataclass

Bases: _SerdeShape

Dataclass for ImportKeyPairOutput structure.

Attributes

key_fingerprint class-attribute instance-attribute
key_fingerprint: str | None = ...
  • For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.

  • 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_name class-attribute instance-attribute
key_name: str | None = ...

The key pair name that you provided.

key_pair_id class-attribute instance-attribute
key_pair_id: str | None = ...

The ID of the resulting key pair.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

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.

tags class-attribute instance-attribute
tags: list[Tag] | None = ...

The tags applied to the imported key pair.