Skip to content

KMS  >  Operations  >  list_keys

list_keys

Operation

list_keys async

list_keys(input: ListKeysInput, plugins: list[Plugin] | None = None) -> ListKeysOutput

Gets a list of all KMS keys in the caller's Amazon Web Services account and Region.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:ListKeys (IAM policy)

Related operations:

  • CreateKey

  • DescribeKey

  • ListAliases

  • ListResourceTags

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.

Parameters:

Name Type Description Default
input ListKeysInput

An instance of ListKeysInput.

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
ListKeysOutput

An instance of ListKeysOutput.

Input

ListKeysInput dataclass

Bases: _SerdeShape

Dataclass for ListKeysInput structure.

Attributes

limit class-attribute instance-attribute
limit: int | None = ...

Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.

This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.

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

Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of NextMarker from the truncated response you just received.

Output

ListKeysOutput dataclass

Bases: _SerdeShape

Dataclass for ListKeysOutput structure.

Attributes

keys class-attribute instance-attribute
keys: list[KeyListEntry] | None = ...

A list of KMS keys.

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

When Truncated is true, this element is present and contains the value to use for the Marker parameter in a subsequent request.

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.

truncated class-attribute instance-attribute
truncated: bool = ...

A flag that indicates whether there are more items in the list. When this value is true, the list in this response is truncated. To get more items, pass the value of the NextMarker element in this response to the Marker parameter in a subsequent request.