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
Name | Description | Required | Type |
---|---|---|---|
Content-Type | Must be "application/x-amz-json-1.1" | Yes | string |
X-Amz-Target | Must be "TrentService.ListKeys" | Yes | string |
Request Body
Name | Description | Required | Type |
---|---|---|---|
Limit | Use 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. | No | integer |
Marker | 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. | No | string |
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
Name | Description | Required | Type |
---|---|---|---|
Keys | A list of KMS keys. | No | String |
Keys[].KeyId | The globally unique identifier for the KMS key. | No | String |
Keys[].KeyArn | The Amazon Resource Name (ARN) of the KMS key. | No | String |
NextMarker | When Truncated is true, this value is present and contains the value to use for the Marker parameter in a subsequent request. | No | String |
Truncated | 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 subsequent requests. | No | String |
Special Errors
Error Code | Description |
---|---|
DependencyTimeoutException | The system timed out while trying to fulfill the request. |
InvalidMarkerException | The request was rejected because the marker that specifies where pagination should next begin is not valid. |
KMSInternalException | An 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.