2026/11/16 - AWS Key Management Service - 1 updated api methods
Changes AWS KMS now supports sharing KMS keys across AWS accounts using AWS Resource Access Manager (AWS RAM). This release adds the optional ResourceOwners parameter to ListKeys, which lists keys owned by the caller's account (SELF), keys shared with the account through AWS RAM, or both.
{'ResourceOwners': ['SELF | OTHER_ACCOUNTS_VIA_RAM']}
Gets a list of all KMS keys in the caller's Amazon Web Services account and Region.
You can also use ListKeys to list KMS keys in the Region that other Amazon Web Services accounts shared with the caller's Amazon Web Services account through Resource Access Manager (RAM). To list them, use the ResourceOwners parameter. If you omit ResourceOwners, ListKeys lists only the KMS keys in the caller's Amazon Web Services account.
When ResourceOwners includes OTHER_ACCOUNTS_VIA_RAM, ListKeys returns the KMS keys that other Amazon Web Services accounts currently share with the caller's Amazon Web Services account through RAM. For information about how and when a resource that another account shares becomes available to your Amazon Web Services account, see Access Amazon Web Services resources shared with you in the RAM User Guide.
Cross-account use: No. This operation doesn't take a KMS key parameter, so you can't use it to list the KMS keys of a specific Amazon Web Services account. The only KMS keys in other Amazon Web Services accounts that ListKeys returns are the ones that other accounts shared with the caller's Amazon Web Services account through RAM. To list them, set the ResourceOwners parameter to include OTHER_ACCOUNTS_VIA_RAM.
Required permissions: kms:ListKeys (IAM policy)
The same kms:ListKeys permission lets you list the KMS keys that other accounts shared with you through RAM. KMS doesn't evaluate the key policies of shared KMS keys when it lists them. To use a shared KMS key, you need permission for each operation on that KMS key.
Related operations:
CreateKey
DescribeKey
ListAliases
ListResourceTags
Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.
KMS keys that other Amazon Web Services accounts share with you can take some time to appear in or disappear from ListKeys results after changes to resource shares, such as accepting an invitation or deleting a resource share.
See also: AWS API Documentation
Request Syntax
client.list_keys(
Limit=123,
Marker='string',
ResourceOwners=[
'SELF'|'OTHER_ACCOUNTS_VIA_RAM',
]
)
integer
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.
string
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.
list
Specifies whose KMS keys to list. Use this parameter to list KMS keys that other Amazon Web Services accounts shared with your Amazon Web Services account through Resource Access Manager (RAM).
Specify one or two values. Valid values are:
SELF
Lists the KMS keys in your Amazon Web Services account and Region.
OTHER_ACCOUNTS_VIA_RAM
Lists the KMS keys in the Region that other Amazon Web Services accounts currently share with your Amazon Web Services account through RAM. This list doesn't include KMS keys that your Amazon Web Services account owns. For each of these KMS keys, the key ARN in the response contains the account ID of the Amazon Web Services account that owns the KMS key.
If you omit this parameter, ListKeys lists only the KMS keys in your Amazon Web Services account. If you specify both values, in either order, ListKeys returns the KMS keys in your Amazon Web Services account first, and then the KMS keys that other Amazon Web Services accounts shared with you. A single response doesn't contain both kinds of KMS keys.
When ResourceOwners includes OTHER_ACCOUNTS_VIA_RAM, a response can contain fewer KMS keys than the Limit value, or none, even when Truncated is true. To get all of the KMS keys, continue calling ListKeys with the NextMarker value from each response until Truncated is false. Use a NextMarker value only in a request that has the same ResourceOwners value as the request that returned it. Otherwise, the request can fail with an InvalidMarkerException.
KMS keys that other Amazon Web Services accounts share with you can take some time to appear in or disappear from the results after changes to resource shares.
(string) --
Identifies whose KMS keys ListKeys lists. SELF identifies the KMS keys in your Amazon Web Services account. OTHER_ACCOUNTS_VIA_RAM identifies the KMS keys that other Amazon Web Services accounts shared with your Amazon Web Services account through Resource Access Manager (RAM).
dict
Response Syntax
{
'Keys': [
{
'KeyId': 'string',
'KeyArn': 'string'
},
],
'NextMarker': 'string',
'Truncated': True|False
}
Response Structure
(dict) --
Keys (list) --
A list of KMS keys. For a KMS key that another Amazon Web Services account shared with you through RAM, the key ARN contains the account ID of the Amazon Web Services account that owns the KMS key.
(dict) --
Contains information about each entry in the key list.
KeyId (string) --
Unique identifier of the key.
KeyArn (string) --
ARN of the key.
NextMarker (string) --
When Truncated is true, this element is present and contains the value to use for the Marker parameter in a subsequent request.
Truncated (boolean) --
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.