PutKeyPolicy - AWS Key Management Service
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

PutKeyPolicy

The following example shows an AWS CloudTrail log entry generated by calling the PutKeyPolicy operation. For information about updating a key policy, see Change a key policy.

{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::111122223333:user/Alice", "accountId": "111122223333", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2022-09-01T20:06:16Z", "eventSource": "kms.amazonaws.com", "eventName": "PutKeyPolicy", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "AWS Internal", "requestParameters": { "keyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "policyName": "default", "policy": "{\n \"Version\" : \"2012-10-17\",\n \"Id\" : \"key-default-1\",\n \"Statement\" : [ {\n \"Sid\" : \"Enable IAM User Permissions\",\n \"Effect\" : \"Allow\",\n \"Principal\" : {\n \"AWS\" : \"arn:aws:iam::111122223333:root\"\n },\n \"Action\" : \"kms:*\",\n \"Resource\" : \"*\"\n } ]\n}", "bypassPolicyLockoutSafetyCheck": false }, "responseElements": null, "requestID": "7bb906fa-dc21-4350-b65c-808ff0f72f55", "eventID": "c217db1f-903f-4a2f-8f88-9580182d6313", "readOnly": false, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }

When AWS Resource Access Manager (AWS RAM) writes the AWS_RAM key policy of a shared KMS key, AWS KMS records a PutKeyPolicy entry in the AWS account that owns the KMS key. In this entry, the value of the policyName field in requestParameters is AWS_RAM. For information about the AWS_RAM key policy, see How managed permissions are shown in KMS keys.