Skip to content

EC2  >  Operations  >  describe_key_pairs

describe_key_pairs

Operation

describe_key_pairs async

describe_key_pairs(request: DescribeKeyPairsInput | DescribeKeyPairsInputDict, /, *, plugins: list[Plugin] | None = None) -> DescribeKeyPairsOutput
describe_key_pairs(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[DescribeKeyPairsInputDict]) -> DescribeKeyPairsOutput

Describes the specified key pairs or all of your key pairs.

For more information about key pairs, see Amazon EC2 key pairs in the Amazon EC2 User Guide.

Parameters:

Name Type Description Default
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
DescribeKeyPairsOutput

An instance of DescribeKeyPairsOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

DescribeKeyPairsInput dataclass

Bases: _SerdeShape

Dataclass for DescribeKeyPairsInput 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.

filters class-attribute instance-attribute
filters: list[Filter] | None = ...

The filters.

  • key-pair-id - The ID of the key pair.

  • fingerprint - The fingerprint of the key pair.

  • key-name - The name of the key pair.

  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

  • tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

include_public_key class-attribute instance-attribute
include_public_key: bool | None = ...

If true, the public key material is included in the response.

Default: false

key_names class-attribute instance-attribute
key_names: list[str] | None = ...

The key pair names.

Default: Describes all of your key pairs.

key_pair_ids class-attribute instance-attribute
key_pair_ids: list[str] | None = ...

The IDs of the key pairs.

Dictionaries

DescribeKeyPairsInputDict

Bases: TypedDict

Dictionary form of DescribeKeyPairsInput.

Attributes
dry_run 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.

filters instance-attribute
filters: Sequence[Filter | FilterDict] | None

The filters.

  • key-pair-id - The ID of the key pair.

  • fingerprint - The fingerprint of the key pair.

  • key-name - The name of the key pair.

  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

  • tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

include_public_key instance-attribute
include_public_key: bool | None

If true, the public key material is included in the response.

Default: false

key_names instance-attribute
key_names: Sequence[str] | None

The key pair names.

Default: Describes all of your key pairs.

key_pair_ids instance-attribute
key_pair_ids: Sequence[str] | None

The IDs of the key pairs.

Output

DescribeKeyPairsOutput dataclass

Bases: _SerdeShape

Dataclass for DescribeKeyPairsOutput structure.

Attributes

key_pairs class-attribute instance-attribute
key_pairs: list[KeyPairInfo] | None = ...

Information about the key pairs.

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.