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

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

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.

```json
{
  "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.

- Allows 58 actions (kms:*) on every resource.

Checks:
- high: Allows 42 write or permissions-management actions (4 permissions management) on every resource ("Resource": "*"). (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)

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

## Least privilege rewrite

```json
{
  "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.

- Allows 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.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every KMS action and its access level](/actions/kms/)

## Related pages

- [IAM policy example: use a KMS key only through S3](/examples/kms-use-key-through-s3-only/)
- [IAM policy example: administer KMS keys without using them](/examples/kms-key-administrator-without-use/)
- [IAM policy example: read one Secrets Manager secret](/examples/secretsmanager-read-one-secret/)
- [All of them](/examples/)

## Sources

- AWS KMS Developer Guide: default key policy: https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html (read 16 Nov 2026)
- AWS KMS Developer Guide: key policies: https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/kms-encrypt-decrypt-one-key/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
