Skip to content
IAM Policy Generator

IAM policy example: use one KMS key to encrypt and decrypt, with a least privilege rewrite

Allows a role to encrypt, decrypt and generate data keys with one KMS key. The original allows kms:* on every key. The rewrite lists five cryptographic actions on one key ARN. The key policy on that key must also allow the account to use IAM policies.

Open the workbench ยท All examples

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "UseKeys",
      "Effect": "Allow",
      "Action": "kms:*",
      "Resource": "*"
    }
  ]
}

What it allows

  • Allows every KMS action on every key, including deleting keys and changing key policies.

What it allows

  1. Allow 58 actions (kms:*) on every resource.

    Action or patternActionsAccess levels
    kms:*58List 7, Read 7, Write 38, Permissions management 4, Tagging 2

Checks

The action kms:* covers 58 actions on all keys, which includes scheduling key deletion and creating grants.

Least privilege rewrite

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "UseOneKey",
      "Effect": "Allow",
      "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:ReEncrypt*",
        "kms:GenerateDataKey*",
        "kms:DescribeKey"
      ],
      "Resource": "arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
    }
  ]
}

The rewrite names one key ARN and five cryptographic actions. Key deletion, policy changes and grants are removed.

What it allows

  1. Allow 9 actions (kms:Encrypt, kms:Decrypt, kms:ReEncrypt*, kms:GenerateDataKey*, kms:DescribeKey) on arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab.

    Action or patternActionsAccess levels
    kms:Encrypt1Write 1
    kms:Decrypt1Write 1
    kms:ReEncrypt*2Write 2
    kms:GenerateDataKey*4Write 4
    kms:DescribeKey1Read 1

Checks

No flags from the six checks.

Sources

  1. AWS KMS Developer Guide: default key policy, read 16 Nov 2026
  2. AWS KMS Developer Guide: key policies, read 16 Nov 2026
  3. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.