- KMS overview and core concepts
- Envelope encryption data flow
- CMK lifecycle and access control (key policies, grants, IAM)
- Common KMS integrations and implementation patterns
- Key rotation strategies and best practices

KMS also supports importing your own key material and issuing grants (temporary scoped permissions).

- Call KMS to generate a data key (returns plaintext data key and a KMS-wrapped CiphertextBlob).
- Use the plaintext data key locally to encrypt your data (e.g., AES‑GCM).
- Store the encrypted data with the encrypted data key (CiphertextBlob).
- To decrypt, call KMS to decrypt the encrypted data key, then use the resulting plaintext key to decrypt the data.

alias/my-key) to abstract key identifiers from applications and simplify rotation.

- Evaluate the key policy (KMS resource policy) first.
- If the key policy allows the principal, evaluate grants attached to the CMK (temporary scoped permissions).
- If neither key policy nor grants allow the action, evaluate the principal’s IAM policies — but this is only effective when the key policy explicitly permits IAM principals to use the key.
- Access is granted only if the combined evaluation permits it; otherwise access is denied.

Key policies act as the primary gate for CMK operations. Ensure your key policy explicitly allows the IAM principals you intend to use; otherwise IAM policies alone will not grant access.
kms:Encrypt, kms:Decrypt, kms:GenerateDataKey — these align with envelope encryption workflows.
Implementation patterns
Common ways to implement envelope encryption with KMS:
- Direct KMS API calls (e.g.,
GenerateDataKey,Decrypt) - AWS Encryption SDK (higher-level, multi-language abstractions)
- Service-specific integrations (SSE‑KMS for S3, RDS encryption, Secrets Manager, etc.)


KmsKeyId, KmsMasterKeyId, KmsDataKeyReusePeriodSeconds). These examples are for learning resource references and patterns — templates may vary in real deployments.
- Automatic rotation (supported for symmetric CMKs): rotates key material within the same CMK on a schedule. Low operational overhead.
- Manual rotation with aliases: create a new CMK and repoint an alias (e.g.,
alias/my-key) to the new CMK. Offers more control and clearer audit of CMK changes.
- Use aliases in applications to avoid code/config changes during rotation.
- For envelope encryption, securely zero plaintext data key material from memory as soon as it’s no longer needed.
- Test rotation and decryption paths in staging before deploying to production.

Scheduling deletion of a CMK can cause irreversible loss of access to any data encrypted with it after the deletion completes. Use a conservative waiting period and confirm affected resources before scheduling key deletion.
- KMS is AWS’s centralized key management service; use CMKs when you require control over key material, policy, and cross-account use.
- Prefer envelope encryption for large-data encryption: it reduces KMS API usage and improves performance.
- Design key policies carefully — they are evaluated before IAM policies and are the primary gate for CMK operations.
- Use aliases to minimize application impact during key rotation and to simplify operational management.
- Leverage service integrations (S3, RDS, Secrets Manager, SQS, etc.) when possible for simpler encryption-at-rest configurations.
- AWS KMS documentation: https://docs.aws.amazon.com/kms/
- AWS Encryption SDK: https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/what-is-aws-encryption-sdk.html
- AWS CloudHSM: https://aws.amazon.com/cloudhsm/
- AWS KMS concepts and best practices: https://docs.aws.amazon.com/kms/latest/developerguide/overview.html