Skip to content

KMSClient.get_key_policy

rboto-kms==0.4.0 · Service index · Types

Model summary (excerpt): Gets a key policy attached to the specified KMS key. A KMS key can have two key policies. You manage the default key policy. Resource Access Manager (RAM) manages the AWS_RAM key policy for KMS keys that you share through RAM. You can use GetKeyPolicy to view the AWS_RAM key policy, but you can't change it with PutKeyPolicy . To get the AWS_RAM key policy, set the PolicyName parameter to...

Install and imports

python -m pip install "rboto[kms]==0.4.0"
from rboto import KMSClient
from rboto_kms.types import (
    GetKeyPolicyOutput,
)

Signature

async def get_key_policy(
    *,
    key_id: str,
    policy_name: str | None = None,
) -> GetKeyPolicyOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
key_id Yes Identifies the KMS key whose key policy you want to get. Specify the key ID or key ARN of the KMS key. For example: Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey .
policy_name No Specifies the name of the key policy. If no policy name is specified, the default value is default . Valid values are default and AWS_RAM . Use AWS_RAM to get the key policy that RAM manages for a KMS key that you share through RAM. If the KMS key doesn't have an AWS_RAM key policy, the request fails with a NotFoundException . To get the names of key policies, use ListKeyPolicies .

Output

GetKeyPolicyOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
policy str | None Always present —
policy_name str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

GetKeyPolicyOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_kms.exceptions:

DependencyTimeoutError, InvalidArnError, KMSInternalError, KMSInvalidStateError, NotFoundError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model