AWS Key Management Service
API Reference (API Version 2014-11-01)

ListAliases

Gets a list of aliases in the caller's AWS account and region. You cannot list aliases in other accounts. For more information about aliases, see CreateAlias.

By default, the ListAliases command returns all aliases in the account and region. To get only the aliases that point to a particular customer master key (CMK), use the KeyId parameter.

The ListAliases response can include aliases that you created and associated with your customer managed CMKs, and aliases that AWS created and associated with AWS managed CMKs in your account. You can recognize AWS aliases because their names have the format aws/<service-name>, such as aws/dynamodb.

The response might also include aliases that have no TargetKeyId field. These are predefined aliases that AWS has created but has not yet associated with a CMK. Aliases that AWS creates in your account, including predefined aliases, do not count against your AWS KMS aliases limit.

Request Syntax

{ "KeyId": "string", "Limit": number, "Marker": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

KeyId

Lists only aliases that refer to the specified CMK. The value of this parameter can be the ID or Amazon Resource Name (ARN) of a CMK in the caller's account and region. You cannot use an alias name or alias ARN in this value.

This parameter is optional. If you omit it, ListAliases returns all aliases in the account and region.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Required: No

Limit

Use this parameter to specify the maximum number of items to return. When this value is present, AWS 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 100, inclusive. If you do not include a value, it defaults to 50.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 100.

Required: No

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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [\u0020-\u00FF]*

Required: No

Response Syntax

{ "Aliases": [ { "AliasArn": "string", "AliasName": "string", "TargetKeyId": "string" } ], "NextMarker": "string", "Truncated": boolean }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Aliases

A list of aliases.

Type: Array of AliasListEntry objects

NextMarker

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [\u0020-\u00FF]*

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 this response to the Marker parameter in a subsequent request.

Type: Boolean

Errors

For information about the errors that are common to all actions, see Common Errors.

DependencyTimeoutException

The system timed out while trying to fulfill the request. The request can be retried.

HTTP Status Code: 500

InvalidMarkerException

The request was rejected because the marker that specifies where pagination should next begin is not valid.

HTTP Status Code: 400

KMSInternalException

The request was rejected because an internal exception occurred. The request can be retried.

HTTP Status Code: 500

Examples

The following examples are formatted for legibility.

Example Request

POST / HTTP/1.1 Host: kms.us-east-2.amazonaws.com Content-Length: 2 X-Amz-Target: TrentService.ListAliases X-Amz-Date: 20161203T011453Z Content-Type: application/x-amz-json-1.1 Authorization: AWS4-HMAC-SHA256\ Credential=AKIAI44QH8DHBEXAMPLE/20161203/us-east-2/kms/aws4_request,\ SignedHeaders=content-type;host;x-amz-date;x-amz-target,\ Signature=c2867e5f45167bf713e8f2c9998772ad72a20958db2cc0ef46bfba1632ca4d62 {}

Example Response

HTTP/1.1 200 OK Server: Server Date: Sat, 03 Dec 2016 01:14:55 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 2874 Connection: keep-alive x-amzn-RequestId: e6196175-b8f5-11e6-b404-15dcd0a7add5 { "Aliases": [ { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/acm", "AliasName": "alias/aws/acm", "TargetKeyId": "da03f6f7-d279-427a-9cae-de48d07e5b66" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/ebs", "AliasName": "alias/aws/ebs", "TargetKeyId": "25a217e7-7170-4b8c-8bf6-045ea5f70e5b" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/rds", "AliasName": "alias/aws/rds", "TargetKeyId": "7ec3104e-c3f2-4b5c-bf42-bfc4772c6685" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/redshift", "AliasName": "alias/aws/redshift" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/s3", "AliasName": "alias/aws/s3", "TargetKeyId": "d2b0f1a3-580d-4f79-b836-bc983be8cfa5" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/example1", "AliasName": "alias/example1", "TargetKeyId": "4da1e216-62d0-46c5-a7c0-5f3a3d2f8046" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/example2", "AliasName": "alias/example2", "TargetKeyId": "f32fef59-2cc2-445b-8573-2d73328acbee" }, { "AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/example3", "AliasName": "alias/example3", "TargetKeyId": "1374ef38-d34e-4d5f-b2c9-4e0daee38855" } ], "Truncated": false }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: