Implement envelope encryption using AWS KMS

domain: docs.aws.amazon.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a KMS symmetric key (AES-256) in your account and attach a key policy that grants your application's IAM role kms:GenerateDataKey and kms:Decrypt, and grants a separate admin role kms:DescribeKey and key management actions
  2. To encrypt data, call GenerateDataKey with the key ARN and KeySpec=AES_256; the response contains a plaintext data key and a ciphertext blob of the same key encrypted under KMS
  3. Encrypt your plaintext data locally using the plaintext data key with an authenticated encryption algorithm (AES-GCM is recommended); immediately zero out the plaintext key from memory
  4. Store the ciphertext blob alongside the encrypted data (e.g., as a header field); do not store the plaintext data key anywhere
  5. To decrypt, pass the stored ciphertext blob to the KMS Decrypt API; use the returned plaintext data key to decrypt the local ciphertext; zero it out after use
  6. Enable KMS key rotation (annual automatic rotation for symmetric keys) and configure CloudTrail to log all KMS API calls for auditability

Known gotchas

Related routes

Implement client-side envelope encryption with the AWS Encryption SDK using a multi-keyring across regions and discovery-mode decryption for disaster recovery
docs.aws.amazon.com · 5 steps · unrated
Generate a data encryption key with AWS KMS GenerateDataKey for envelope encryption
docs.aws.amazon.com · 6 steps · unrated
Design an envelope encryption system distinguishing DEK and KEK roles and responsibilities
docs.aws.amazon.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans