Skip to main content

ListKeys

Gets a list of all KMS keys in the caller's account and region.

Description

The ListKeys operation gets a list of all KMS keys in the caller's account and region. This operation returns the key ID and Amazon Resource Name (ARN) of each KMS key.

note
  • The response might include KMS keys that you created and KMS keys that QKMS created on your behalf.
  • The response includes both enabled and disabled KMS keys.
  • The response includes both customer managed keys and AWS managed keys.
  • To get detailed information about a KMS key, use the DescribeKey operation.

Request Syntax

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.ListKeys
{ "Limit": 20, "Marker": "eyJlbmNyeXB0ZWREYXRhIjpbMTIsMzQsNTYsNzgsOTBdfQ==" }
Values in italics indicate user input and should be replaced with actual values.

Request Parameters

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.ListKeys"Yesstring

Request Body

NameDescriptionRequiredType
LimitUse this parameter to specify the maximum number of items to return. When this value is present, QKMS does not return more than the specified number of items, but it might return fewer.Nointeger
MarkerUse 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.Nostring

Examples

Example 1: List all KMS keys in your account

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.ListKeys
{}
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "Keys": [ { "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "KeyArn": "arn:verenc:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" }, { "KeyId": "0987dcba-09fe-87dc-65ba-ab0987654321", "KeyArn": "arn:verenc:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321" } ], "Truncated": false }
Values in italics indicate variable response values.

Example 2: List KMS keys with pagination

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.ListKeys
{ "Limit": 1 }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "Keys": [ { "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "KeyArn": "arn:verenc:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ], "NextMarker": "eyJlbmNyeXB0ZWREYXRhIjpbMTIsMzQsNTYsNzgsOTBdfQ==", "Truncated": true }
Values in italics indicate variable response values.

Response Syntax

HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "Keys": [ { "KeyId": "string", "KeyArn": "string" } ], "NextMarker": "string", "Truncated": "boolean" }
Values in italics indicate variable response values.

Response Elements

NameDescriptionRequiredType
KeysA list of KMS keys.NoString
Keys[].KeyIdThe globally unique identifier for the KMS key.NoString
Keys[].KeyArnThe Amazon Resource Name (ARN) of the KMS key.NoString
NextMarkerWhen Truncated is true, this value is present and contains the value to use for the Marker parameter in a subsequent request.NoString
TruncatedA 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 subsequent requests.NoString

Special Errors

Error CodeDescription
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
InvalidMarkerExceptionThe request was rejected because the marker that specifies where pagination should next begin is not valid.
KMSInternalExceptionAn internal error occurred.

Permissions

To use the ListKeys operation, you must have the following permissions:

  • kms:ListKeys on the KMS key (specified in the policy)

Try It Out

Test ListKeys

List KMS keys in your account.

Coming Soon

This feature is currently under development and will be available soon.