Generate a data encryption key with AWS KMS GenerateDataKey for envelope encryption

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 or identify a KMS symmetric key (key type SYMMETRIC_DEFAULT) and note its key ID or ARN
  2. Call GenerateDataKey with the key ID and desired KeySpec (e.g., AES_256), optionally supplying an EncryptionContext map for additional authenticated data
  3. Receive the plaintext DEK and the ciphertext blob; use the plaintext DEK in memory to encrypt your payload with a library such as AES-GCM, then discard the plaintext DEK
  4. Store the ciphertext blob alongside the encrypted payload so the KEK identity is recorded but the plaintext key is never persisted
  5. To decrypt, call KMS Decrypt with the stored ciphertext blob and the same EncryptionContext, receive the plaintext DEK, decrypt the payload, then discard the DEK again
  6. Rotate the KMS key on a schedule (consult current docs for automatic rotation options) and rewrap stored ciphertext blobs as needed

Known gotchas

Related routes

Implement envelope encryption using AWS KMS
docs.aws.amazon.com · 6 steps · unrated
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
Use AWS KMS EncryptionContext as additional authenticated data to bind ciphertext to its context
docs.aws.amazon.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ 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