L11. AWS KMS: Key Policies, Envelope Encryption & Key Rotation
Video generating
Check back soon for the video lesson on AWS KMS: Key Policies, Envelope Encryption & Key Rotation
Course outlineLesson 11 of 18
Learn KMS authorization through policies and grants, local envelope encryption with data keys, rotation eligibility, and when dedicated HSM control calls for CloudHSM.
The Key Policy Is the Root of Authorization
KMS authorization requires explicit access and no applicable deny. Every customer managed key (CMK) has a resource-based key policy attached directly to it, and that key policy is the root of authorization. An IAM allow forkms:Decrypt is not effective unless the key policy enables IAM permissions. A key policy can instead grant access directly, and a valid KMS grant can authorize supported operations. Check applicable explicit denies as well as the key policy, identity policies and grants.
KMS grants are a second, more surgical access mechanism: programmatic, revocable delegated access to a specific key, typically used by an AWS service acting on a customer's behalf (for example, letting an EBS volume use a CMK to encrypt its blocks). Grants can be created and retired without editing the key policy. They do not expire automatically; retire or revoke them when they are no longer needed.
Envelope Encryption: Keep Bulk Data Off the Wire
KMS does not encrypt large files directly, and the exam expects you to know why. The pattern is envelope encryption:
- The application calls
GenerateDataKeyagainst a CMK. - KMS returns a plaintext data key, and that same data key encrypted under the CMK.
- The application encrypts the actual data locally with the plaintext key, then discards that plaintext copy.
- The application stores the encrypted data key alongside the ciphertext.
In this pattern, KMS generates and protects the data key; the application sends no bulk file content to KMS. This keeps encryption fast and avoids KMS API payload limits. To decrypt later, the application sends the encrypted data key back to KMS, gets the plaintext key back, and decrypts the ciphertext locally.
Key Rotation Rules
| Key type | Rotation support |
|---|---|
| AWS-managed keys (aws/s3, aws/ebs, etc.) | Always on, cannot be disabled |
| Symmetric customer managed keys with AWS_KMS origin | Optional automatic rotation with a configurable period, or on-demand rotation |
| Symmetric customer managed keys with imported material | No automatic rotation; on-demand rotation supported after importing new material |
| Asymmetric, HMAC or custom key store keys | Manual rotation to a new KMS key |
Multi-Region Keys and CloudHSM
Multi-Region keys replicate a CMK across regions as related keys sharing the same key material and key ID. Data encrypted in one region can be decrypted in another using the replica key, with no decrypt-and-re-encrypt round trip during failover, which matters for disaster recovery designs with cross-region replication. AWS CloudHSM provides dedicated HSMs under customer control. The hsm2m.medium type is FIPS 140-3 Level 3 validated; the older hsm1.medium FIPS 140-2 certificate moved to the historical list in January 2026. Standard KMS also uses FIPS 140-3 Security Level 3 validated HSMs. Choose CloudHSM for dedicated tenancy and direct HSM control, not merely because a question mentions Level 3. A KMS custom key store can use a customer CloudHSM cluster behind the KMS API. Exam tip: If an IAM policy "should" grant access to a KMS key but doesn't seem to work, check whether the key policy is the missing piece. Whenever "bulk data" and "KMS" appear together, think envelope encryption andGenerateDataKey, not a direct Encrypt call on the whole payload.
References
Continue Learning
- ✓A KMS key policy can enable IAM delegation or grant access directly; KMS grants are another authorization mechanism, and explicit denies still apply
- ✓Envelope encryption uses GenerateDataKey to get a plaintext data key and its CMK-encrypted copy; only the small data key ever needs to be encrypted by KMS, not the bulk data
- ✓Automatic rotation supports symmetric AWS_KMS keys; symmetric imported-material keys support on-demand rotation, not automatic rotation
- ✓Multi-Region KMS keys share key material across regions, avoiding decrypt-and-re-encrypt cycles for data replicated between regions
- ✓CloudHSM provides dedicated HSM control; KMS also uses FIPS 140-3 Level 3 validated HSMs
1. A user has an IAM policy granting kms:Decrypt on all resources, but the target KMS key's key policy does not reference that user or their account. No KMS grant authorizes the user. Can this IAM allow alone authorize decryption?
2. Why does envelope encryption call GenerateDataKey instead of sending the entire file to KMS to encrypt directly?
3. A company must use single-tenant hardware security modules validated to FIPS 140-3 Level 3 with direct HSM control and dedicated tenancy. Which service should they use?