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
AWS_RAM. If the KMS key doesn't have an
AWS_RAM key policy,
GetKeyPolicy returns a
NotFoundException. For information about sharing KMS keys, see
Sharing KMS keys with RAM in the
Key Management Service Developer Guide. For information about RAM managed permissions, see
Managing permissions in RAM in the
RAM User Guide.
Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.
Required permissions:
kms:GetKeyPolicy (key policy)
You can use the
kms:PolicyName condition key to control access to this operation based on the value of the
PolicyName parameter in the request. If the request doesn't include
PolicyName, the value of
kms:PolicyName is
default.
Related operations:
PutKeyPolicyEventual consistency: The KMS API follows an eventual consistency model. For more information, see
KMS eventual consistency.