AWS kms: Add key policy example to KMS GetKeyPolicy docs
Summary
Updated example key IDs and added a sample policy.txt key policy document plus a link to the key policies guide.
Security assessment
The change adds an illustrative KMS key policy (with IAM root principal and kms:* action) and links to the key policies guide, documenting a security feature rather than fixing a vulnerability.
Evidence
"Sid": "Enable IAM User Permissions",
Diff
diff --git a/kms/latest/developerguide/example_kms_GetKeyPolicy_section.md b/kms/latest/developerguide/example_kms_GetKeyPolicy_section.md index 597a1d6..a40ae95 100644 --- a//kms/latest/developerguide/example_kms_GetKeyPolicy_section.md +++ b//kms/latest/developerguide/example_kms_GetKeyPolicy_section.md @@ -33 +33 @@ Because the `--policy` parameter of `put-key-policy` requires a string, you must - --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ + --key-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ @@ -36,0 +37,4 @@ Because the `--policy` parameter of `put-key-policy` requires a string, you must + +The following `put-key-policy` example uses the `policy.txt` file to replace the key policy of the other KMS key. + + @@ -39 +43 @@ Because the `--policy` parameter of `put-key-policy` requires a string, you must - --key-id 0987dcba-09fe-87dc-65ba-ab0987654321 \ + --key-id a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 \ @@ -42,0 +47,19 @@ Because the `--policy` parameter of `put-key-policy` requires a string, you must +Contents of `policy.txt`: + + + { + "Version":"2012-10-17", + "Id": "key-default-1", + "Statement": [ + { + "Sid": "Enable IAM User Permissions", + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::123456789012:root" + }, + "Action": "kms:*", + "Resource": "*" + } + ] + } + @@ -45 +68 @@ This command produces no output. -For more information, see [PutKeyPolicy](https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html) in the _AWS KMS API Reference_. +For more information, see [Key policies in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) in the _AWS Key Management Service Developer Guide_.