AWS KMS key policies are a separate authorisation plane from IAM, and teams that read KMS access as "whatever IAM says" routinely grant decryption to the wrong principals or lock themselves out of their own keys. This guide explains how access to a KMS key is actually decided (key policy, IAM, grants and condition keys), which actions are equivalent to administrator rights, how to bind keys to services and data with kms:ViaService and encryption context, and what to log and alert on. It is written for cloud security engineers, platform teams and auditors who run customer managed keys in AWS. Vendor-neutral key management principles such as key lifecycles, custody and HSM choices are covered in the Cryptographic Key Management Guide; this page is specific to AWS KMS.
This is an independent guide from NHI Mgmt Group, based on AWS's public documentation as of November 2026. It is not sponsored or reviewed by AWS. Product features change, so confirm settings against AWS's current documentation.
Key takeaways
- The key policy is the root of trust for every KMS key: IAM policies only work if the key policy delegates to the account, and an IAM allow without that delegation does nothing.
- Key administrators can make themselves key users:
kms:PutKeyPolicyandkms:CreateGrantlet a principal grant any permission on the key, so treat both as privileged. - Bind use to context, not just identity:
kms:ViaService,kms:CallerAccountandkms:EncryptionContext:conditions stop a stolen role credential from decrypting data outside the service and dataset it was meant for. - Deletion is the most destructive KMS action: scheduled deletion (7 to 30 days) makes data permanently unreadable, so restrict it with SCPs and alarm on any attempted use of a key in PendingDeletion state.
- Every KMS call is a CloudTrail event: keep KMS events in your trails, protect
cloudtrail:PutEventSelectors, and use the logged encryption context to see which data each principal decrypted.
How identity and access work in AWS KMS
Every KMS key has exactly one key policy, and KMS does not implicitly trust the account that owns the key. Access is granted by three mechanisms that are evaluated together: the key policy, IAM policies (only where the key policy permits them), and grants. An explicit deny anywhere wins, and SCPs and RCPs in AWS Organizations can cap what any of them allow.
| Mechanism | Scope | Can deny? | Best used for | Watch out for |
|---|---|---|---|---|
| Key policy | One key | Yes | Naming key administrators, key users and cross-account principals; context conditions | Removing the account root statement can make the key unmanageable |
| IAM policy | Many keys | Yes | Granting use of many keys to a role, typically scoped by key ARN or tag | Has no effect unless the key policy delegates to the account |
| Grant | One key, one grantee | No (allow only) | Temporary or service-driven access, such as EBS attaching an encrypted volume | Eventually consistent; invisible in the key policy; up to 50,000 per key |
| SCP / RCP | Organisation, OU, account | Yes (limit only) | Estate-wide rules such as "no key deletion outside the security role" | Never grants access by itself |
The default key policy and the "Enable IAM User Permissions" statement
Keys created through the API, SDK or CLI without a policy receive a single statement that allows the account principal (arn:aws:iam::<account>:root) kms:*. That statement does not give the root user day-to-day access; it delegates to IAM, so that IAM policies in the account can allow use of the key. AWS documents that without it, IAM policies that allow access are ineffective, although IAM denies still apply. It also prevents the key becoming unmanageable: if a policy names only one user and that user is deleted, AWS documents that you must contact AWS Support to regain access.
Keys created in the console get a longer default with separate statements for key administrators (kms:Create*, kms:Put*, kms:Update*, kms:Disable*, kms:ScheduleKeyDeletion and so on) and key users (kms:Encrypt, kms:Decrypt, kms:ReEncrypt*, kms:GenerateDataKey*, kms:DescribeKey), plus an "Allow attachment of persistent resources" statement that lets key users create grants only when kms:GrantIsForAWSResource is true, in other words only when an integrated AWS service asks on their behalf.
Choosing a delegation model
- Delegate to IAM (keep the root statement): simplest for a platform team that already manages IAM centrally. The trade-off is that anyone who can write IAM policies in the account can grant themselves decryption. Mitigate with permission boundaries, SCPs and tag-based IAM conditions.
- Name principals in the key policy (no broad IAM delegation): stronger for high-value keys such as those protecting payment data, backups or secrets, because IAM administrators alone cannot reach the data. The trade-off is operational: every new consumer needs a key policy change, and a mistake can lock the key. Keep a break-glass role named in the policy.
- Small or large organisation: a small team can run a few keys with the console default. A large estate should template key policies in infrastructure as code, use one key per application and data classification per account, and enforce guardrails with SCPs from the organisation management account. See the AWS Organizations and SCPs Guide.
Admin roles and privileged access
AWS warns that key administrators can change the key policy and create grants, and therefore can give themselves other permissions. Separating administrators from users is still worth doing, but only alongside guardrails on the actions below.
| Action | Effect | Guardrail |
|---|---|---|
kms:PutKeyPolicy | Rewrites who can do anything with the key | Pipeline role only; alert on every call; never disable the policy lockout safety check in normal operation |
kms:CreateGrant | A principal with it from a key or IAM policy can create grants for any grant operation, even ones it does not hold | Require kms:GrantIsForAWSResource; limit with kms:GrantOperations and kms:GranteePrincipal |
kms:ScheduleKeyDeletion | Starts a 7 to 30 day countdown to permanent loss of the data | Deny via SCP except for a named security role |
kms:DisableKey | Immediately stops all decryption with the key | Restrict as for deletion; alert |
kms:CreateAlias, kms:UpdateAlias | Repointing an alias silently changes which key applications encrypt with | Restrict; control use with kms:RequestAlias |
kms:ImportKeyMaterial, kms:DeleteImportedKeyMaterial | Imported material can be removed or set to expire, making the key unusable at once | Restrict to the key custodian role |
cloudtrail:PutEventSelectors | Can exclude all KMS events from a trail | Deny via SCP outside the logging pipeline |
A useful SCP denies kms:ScheduleKeyDeletion and kms:DisableKey unless aws:PrincipalArn matches the security administration role. Pair it with a two-person process for that role: deletion is rarely urgent, and disabling a key first is a reversible way to prove nothing still depends on it.
Integrations, API tokens and service accounts
Almost every caller of KMS is a machine identity: an application role calling GenerateDataKey for envelope encryption, or an AWS service such as S3, EBS, RDS, Secrets Manager or Lambda calling KMS on a role's behalf. The control goal is that a stolen workload credential can only decrypt the data that workload owns, through the service it normally uses. See the Envelope Encryption and KMS Integration Patterns Guide.
Condition keys that bind use
| Condition key | What it restricts | Example use |
|---|---|---|
kms:ViaService | Use only through a named AWS service endpoint | Role may decrypt only via s3.eu-west-2.amazonaws.com, not by calling KMS directly |
kms:CallerAccount | Use only by principals in a given account | Combine with kms:ViaService for keys shared with an AWS service |
kms:EncryptionContext:<key> | Value of a specific context pair | Decrypt only when AppName=Payments, or only for one bucket ARN |
kms:EncryptionContextKeys | Which context keys must be present | Require every request to carry a tenant key |
kms:GrantIsForAWSResource | Grant created by an integrated service | Let EBS or RDS create grants without letting users create them directly |
kms:GrantOperations, kms:GranteePrincipal, kms:RetiringPrincipal | Shape of grants a principal may create | Allow only Decrypt grants to a named processing role |
kms:RequestAlias | Alias used in the request | Allow use only via alias/app-prod-data |
kms:RotationPeriodInDays | Rotation period a principal may set | Stop administrators setting long periods |
Encryption context
Encryption context is a set of non-secret key-value pairs passed with symmetric encryption operations. KMS uses it as additional authenticated data: it is cryptographically bound to the ciphertext, and decryption fails unless the same context is supplied. It is not encrypted and appears in plaintext in CloudTrail, so never put personal data or secrets in it. AWS services set their own context with an aws: prefix: S3 uses aws:s3:arn (the object ARN, or the bucket ARN when S3 Bucket Keys are on) and EBS uses aws:ebs:id. For your own applications, choose context that names the data (tenant ID, table, file path) so that policies can restrict decryption to that data and logs show exactly what was decrypted.
Grants
Grants give one grantee specific operations on one key, can carry encryption context constraints (EncryptionContextEquals or EncryptionContextSubset, symmetric keys only), and are retired by the named retiring principal or revoked by an administrator. They take seconds, occasionally minutes, to propagate, so a revoked grant may still work briefly; a grant token returned by CreateGrant lets a new grant be used immediately. Because grants do not appear in the key policy, list them with ListGrants during access reviews.
Cross-account and service use
- Cross-account: the key policy must allow the external account and the external account's IAM policy must allow its principal. AWS managed keys such as
aws/s3cannot be shared across accounts, so use a customer managed key, and reference it by full key ARN, not alias, because an alias resolves in the caller's account. - Restrict external principals estate-wide: an RCP can stop any key in your organisation being used by principals outside it. See the AWS Resource Control Policies and Data Perimeter Guide.
- Workload credentials: KMS decryption rights are only as safe as the role credentials that carry them. Use temporary credentials from instance profiles, task roles or OIDC federation. See the AWS STS and AssumeRole Guide.
Logging and detection
CloudTrail records all KMS operations by default, including cryptographic calls such as Decrypt and GenerateDataKey, key management calls such as PutKeyPolicy and DisableKey, and internal events such as RotateKey and DeleteKey. Cross-account calls appear in both the caller's and the key owner's account, except cross-account requests denied for access, which appear only in the caller's account. A trail can exclude KMS events with ExcludeManagementEventSources set to kms.amazonaws.com; this removes all KMS events, not just cryptographic ones, and events not recorded cannot be recovered. That exclusion is sometimes used to save cost, so make it a documented decision and keep at least one organisation trail or CloudTrail Lake event data store that records KMS. See the AWS CloudTrail Guide.
| Event or signal | Why it matters | Response |
|---|---|---|
ScheduleKeyDeletion, DisableKey | Possible destruction or ransom (ATT&CK T1485, T1486) | Page on call; CancelKeyDeletion or EnableKey if unauthorised |
| Failed calls on a key in PendingDeletion | Something still depends on the key | CloudWatch metric filter and alarm, as AWS recommends; cancel deletion |
PutKeyPolicy, CreateGrant by a human or unusual role | Access being widened (T1098 Account Manipulation) | Diff the policy; revoke grant |
Decrypt volume spike or new principal on a sensitive key | Bulk data access with stolen credentials | Correlate with S3, RDS or Secrets Manager reads |
Repeated AccessDeniedException on KMS | Discovery with a compromised credential | Investigate the principal |
PutEventSelectors excluding kms.amazonaws.com | Loss of key usage visibility | Revert; investigate who changed it |
CreateKey with an external origin, or keys used from unknown accounts | Attacker-controlled key material used to encrypt your data | Restrict key creation and origins with SCPs |
Metrics
- Delegation hygiene: percentage of customer managed keys whose policies follow an approved template, checked in CI and by AWS Config.
- Binding coverage: percentage of key-user statements on sensitive keys that carry
kms:ViaServiceor an encryption context condition. - Rotation: percentage of eligible symmetric keys with automatic rotation enabled.
- Deletion safety: number of keys in PendingDeletion and, for each, whether the dependency alarm stayed silent through the waiting period.
- Grant sprawl: active grants per key, and grants whose grantee role no longer exists.
- Visibility: accounts where any trail excludes KMS events (target zero without a recorded exception).
Hardening baseline
| Area | Baseline |
|---|---|
| Key ownership | Customer managed keys for sensitive data; one key per application and data classification; tags for owner and data class |
| Key policy | Template with root delegation (or named break-glass role), separate administrator and user statements, no "Principal": "*" without conditions, no kms:* for users |
| Usage binding | kms:ViaService and kms:CallerAccount for service-integrated keys; encryption context conditions for application keys |
| Grants | Users create grants only with kms:GrantIsForAWSResource; grant constraints for application grants; periodic ListGrants review |
| Rotation | Automatic rotation on symmetric AWS_KMS origin keys (default every 365 days, configurable); on-demand rotation for imported material; AWS managed keys rotate yearly and cannot be changed |
| Deletion | Disable first; schedule deletion with the 30-day default; alarm on use during the window; SCP limits who can schedule |
| Multi-Region keys | Only where data genuinely moves between Regions; the primary cannot be deleted until its replicas are |
| Logging | KMS events retained in an organisation trail sent to a log archive account |
Rotation does not re-encrypt existing data and does not help if a data key has been exposed; it only changes the key material used for new encryption, while old material stays available for decryption. A compromised data key needs re-encryption of the data it protects.
Rollout in phases
- Inventory: list every customer managed key per account and Region with its policy, grants, rotation status, aliases and last use (from CloudTrail). Identify keys with no recent use and keys whose policies grant
kms:*beyond the root statement. - Template: write two or three approved key policy templates (service-integrated, application, cross-account) and validate them with IAM Access Analyzer policy checks before use.
- Guardrails first: deploy SCPs that deny deletion, disabling and KMS event exclusion outside named roles. Start in a pilot OU, confirm no pipeline breaks, then apply to the root.
- Tighten policies: add
kms:ViaServiceand context conditions one application at a time, in a non-production account first. Watch CloudTrail forAccessDeniedExceptionfrom legitimate callers. Rollback is redeploying the previous policy version from source control. - Enable rotation and alarms: turn on automatic rotation for eligible keys, then add the deletion and policy-change alarms.
- Retire unused keys: disable keys with no use for an agreed period, wait, then schedule deletion with the full 30-day window.
Framework mapping
| Control area | NIST CSF 2.0 | NIST SP 800-53 Rev. 5 | CIS Controls v8.1 | ISO/IEC 27001:2022 Annex A |
|---|---|---|---|---|
| Key lifecycle, rotation, deletion | PR.DS-01 | SC-12, SC-13 | 3.11 | A.8.24 |
| Key policies and grants | PR.AA-05 | AC-3, AC-6 | 6.8 | A.8.3, A.5.15 |
| Data at rest protection | PR.DS-01 | SC-28 | 3.11 | A.8.24 |
| KMS event logging and review | PR.PS-04, DE.CM-09 | AU-2, AU-6, AU-12 | 8.2 | A.8.15 |
Common misconfigurations
- Removing the root delegation statement by accident: IAM grants stop working and, if the only named principal is later deleted, the key needs AWS Support to recover.
- Granting
kms:*orkms:CreateGrantto application roles: any compromise of that role can widen its own access or hand access to an outside principal. - Using
"Principal": "*"with no condition in a key policy to "make cross-account work", which opens use of the key to any AWS principal that can reach the data. - Relying on the AWS managed key for shared data:
aws/s3and similar keys cannot be shared across accounts or given custom policies, so teams fall back to copying data or loosening bucket access. - Using aliases in cross-account requests: the alias resolves in the caller's account, so data may be encrypted with the caller's key instead of the owner's.
- Putting identifiers people care about in encryption context: context is logged in plaintext, so email addresses or customer names in it become a log-data exposure.
Practitioner checklist
- Inventory every customer managed key with owner, data class, policy, grants, rotation status and last use.
- Deploy key policies from approved templates in infrastructure as code and validate them before release.
- Deny
kms:ScheduleKeyDeletion,kms:DisableKeyand KMS event exclusion via SCP outside a named security role. - Remove
kms:*and directkms:CreateGrantfrom application roles; requirekms:GrantIsForAWSResourcefor service grants. - Add
kms:ViaService,kms:CallerAccountor encryption context conditions to key-user statements on sensitive keys. - Use customer managed keys, referenced by full ARN, for any cross-account encryption.
- Enable automatic rotation on eligible symmetric keys and document the plan for imported material.
- Alarm on deletion scheduling, disabling, policy changes and any use of a key in PendingDeletion.
- Keep KMS events in an organisation trail delivered to a protected log archive account.
- Review grants with
ListGrantsand key policies at least quarterly as part of access reviews.
Standards and references
- AWS: Default key policy
- AWS: Grants in AWS KMS
- AWS: Encryption context
- AWS: AWS KMS security best practices
- AWS: Rotate AWS KMS keys
- AWS: Delete an AWS KMS key
- AWS: Logging AWS KMS API calls with AWS CloudTrail
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Cryptographic Key Management Guide · AWS Security Guide · Amazon S3 Security Guide · AWS IAM Policies and Roles Guide · HSM Deployment and Operations Guide