Join our Newsletter — 33% off our NHI Course
Home› Guides› AWS KMS Security Guide: Key Policies, Grants and…
Guide Cloud Security

AWS KMS Security Guide: Key Policies, Grants and Encryption Context

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 15 min read
On this page

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:PutKeyPolicy and kms:CreateGrant let a principal grant any permission on the key, so treat both as privileged.
  • Bind use to context, not just identity: kms:ViaService, kms:CallerAccount and kms: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.

MechanismScopeCan deny?Best used forWatch out for
Key policyOne keyYesNaming key administrators, key users and cross-account principals; context conditionsRemoving the account root statement can make the key unmanageable
IAM policyMany keysYesGranting use of many keys to a role, typically scoped by key ARN or tagHas no effect unless the key policy delegates to the account
GrantOne key, one granteeNo (allow only)Temporary or service-driven access, such as EBS attaching an encrypted volumeEventually consistent; invisible in the key policy; up to 50,000 per key
SCP / RCPOrganisation, OU, accountYes (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.

ActionEffectGuardrail
kms:PutKeyPolicyRewrites who can do anything with the keyPipeline role only; alert on every call; never disable the policy lockout safety check in normal operation
kms:CreateGrantA principal with it from a key or IAM policy can create grants for any grant operation, even ones it does not holdRequire kms:GrantIsForAWSResource; limit with kms:GrantOperations and kms:GranteePrincipal
kms:ScheduleKeyDeletionStarts a 7 to 30 day countdown to permanent loss of the dataDeny via SCP except for a named security role
kms:DisableKeyImmediately stops all decryption with the keyRestrict as for deletion; alert
kms:CreateAlias, kms:UpdateAliasRepointing an alias silently changes which key applications encrypt withRestrict; control use with kms:RequestAlias
kms:ImportKeyMaterial, kms:DeleteImportedKeyMaterialImported material can be removed or set to expire, making the key unusable at onceRestrict to the key custodian role
cloudtrail:PutEventSelectorsCan exclude all KMS events from a trailDeny 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 keyWhat it restrictsExample use
kms:ViaServiceUse only through a named AWS service endpointRole may decrypt only via s3.eu-west-2.amazonaws.com, not by calling KMS directly
kms:CallerAccountUse only by principals in a given accountCombine with kms:ViaService for keys shared with an AWS service
kms:EncryptionContext:<key>Value of a specific context pairDecrypt only when AppName=Payments, or only for one bucket ARN
kms:EncryptionContextKeysWhich context keys must be presentRequire every request to carry a tenant key
kms:GrantIsForAWSResourceGrant created by an integrated serviceLet EBS or RDS create grants without letting users create them directly
kms:GrantOperations, kms:GranteePrincipal, kms:RetiringPrincipalShape of grants a principal may createAllow only Decrypt grants to a named processing role
kms:RequestAliasAlias used in the requestAllow use only via alias/app-prod-data
kms:RotationPeriodInDaysRotation period a principal may setStop 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/s3 cannot 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 signalWhy it mattersResponse
ScheduleKeyDeletion, DisableKeyPossible destruction or ransom (ATT&CK T1485, T1486)Page on call; CancelKeyDeletion or EnableKey if unauthorised
Failed calls on a key in PendingDeletionSomething still depends on the keyCloudWatch metric filter and alarm, as AWS recommends; cancel deletion
PutKeyPolicy, CreateGrant by a human or unusual roleAccess being widened (T1098 Account Manipulation)Diff the policy; revoke grant
Decrypt volume spike or new principal on a sensitive keyBulk data access with stolen credentialsCorrelate with S3, RDS or Secrets Manager reads
Repeated AccessDeniedException on KMSDiscovery with a compromised credentialInvestigate the principal
PutEventSelectors excluding kms.amazonaws.comLoss of key usage visibilityRevert; investigate who changed it
CreateKey with an external origin, or keys used from unknown accountsAttacker-controlled key material used to encrypt your dataRestrict 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:ViaService or 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

AreaBaseline
Key ownershipCustomer managed keys for sensitive data; one key per application and data classification; tags for owner and data class
Key policyTemplate with root delegation (or named break-glass role), separate administrator and user statements, no "Principal": "*" without conditions, no kms:* for users
Usage bindingkms:ViaService and kms:CallerAccount for service-integrated keys; encryption context conditions for application keys
GrantsUsers create grants only with kms:GrantIsForAWSResource; grant constraints for application grants; periodic ListGrants review
RotationAutomatic 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
DeletionDisable first; schedule deletion with the 30-day default; alarm on use during the window; SCP limits who can schedule
Multi-Region keysOnly where data genuinely moves between Regions; the primary cannot be deleted until its replicas are
LoggingKMS 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

  1. 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.
  2. 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.
  3. 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.
  4. Tighten policies: add kms:ViaService and context conditions one application at a time, in a non-production account first. Watch CloudTrail for AccessDeniedException from legitimate callers. Rollback is redeploying the previous policy version from source control.
  5. Enable rotation and alarms: turn on automatic rotation for eligible keys, then add the deletion and policy-change alarms.
  6. 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 areaNIST CSF 2.0NIST SP 800-53 Rev. 5CIS Controls v8.1ISO/IEC 27001:2022 Annex A
Key lifecycle, rotation, deletionPR.DS-01SC-12, SC-133.11A.8.24
Key policies and grantsPR.AA-05AC-3, AC-66.8A.8.3, A.5.15
Data at rest protectionPR.DS-01SC-283.11A.8.24
KMS event logging and reviewPR.PS-04, DE.CM-09AU-2, AU-6, AU-128.2A.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:* or kms:CreateGrant to 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/s3 and 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:DisableKey and KMS event exclusion via SCP outside a named security role.
  • Remove kms:* and direct kms:CreateGrant from application roles; require kms:GrantIsForAWSResource for service grants.
  • Add kms:ViaService, kms:CallerAccount or 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 ListGrants and key policies at least quarterly as part of access reviews.

Standards and references

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.