"Is the data encrypted?" is the wrong question, because the answer is almost always yes and it almost never tells you anything. Attackers rarely break AES. The interesting questions are where does the key live, who can call it, and what happens when it has to change. Encryption moves the problem from protecting data to protecting keys, and key management is where programs quietly fail.

The core pattern worth understanding is envelope encryption, and once it clicks, most of a KMS makes sense. You do not encrypt your data directly with a master key. You generate a fresh data encryption key (DEK) for the data, encrypt the data with it, then encrypt that DEK with a key encryption key (KEK) that never leaves the KMS or HSM. You store the encrypted DEK right next to the ciphertext. The master key does one job, wrapping and unwrapping small keys, and stays in a hardened boundary.

Encryption and Key Management, Without the Hand-WavingDiagram with these labels, in reading order: plaintext; encrypt; wrap; ciphertext; wrapped DEK; Plaintext data; Data key (DEK); fresh per object; Encrypt data; with the DEK; KMS / HSM; holds the KEK; Store ciphertext; + wrapped DEK; Over-broad decrypt; permission → anyone; who can call KMS can; read everything; Wrapped DEK stored; somewhere the KEK; policy doesn’t; protect.plaintextencryptwrapciphertextwrapped DEKPlaintext dataData key (DEK)fresh per objectEncrypt datawith the DEKKMS / HSMholds the KEKStore ciphertext+ wrapped DEKOver-broad decryptpermission → anyonewho can call KMS canread everythingWrapped DEK storedsomewhere the KEKpolicy doesn’tprotect
Envelope encryption: the master key wraps keys, never data.

The key hierarchy is the security

Envelope encryption buys you three things. Rotating the KEK is cheap, because at most you re-wrap small DEKs and never touch the data. The blast radius shrinks: a leaked DEK exposes one object, not the estate. And every unwrap is a KMS API call you can log, alert on, and rate-limit. The master key becomes a chokepoint you can watch rather than a secret smeared across config files.

Why it matters: In a mature setup the attacker’s target is no longer the ciphertext, it is the IAM permission to call Decrypt. Access to your data is only as tight as the access policy on the key.

Rotation people actually do

Rotation is where good intentions go to die. Teams enable automatic KEK rotation, feel safe, and miss the point: in AWS KMS, rotating a key does not re-encrypt data or rotate the data keys it generated, and it does nothing about a compromised data key. Real rotation policy distinguishes the layers. KEK rotation should be automatic and cheap (AWS KMS rotates on a schedule, 365 days by default). DEK rotation matters when a key may be compromised or when re-encrypting old data is worth the cost. And rotation is worthless without the ability to revoke: if you cannot make a key un-callable within minutes of a suspected compromise, you have key storage and not key management.

  • Never let the master key leave the boundary. KEKs live in a KMS or HSM and are used by reference. If a human or an app can export the raw KEK, envelope encryption has bought you nothing.
  • Scope decrypt permission ruthlessly. Separate keys per environment, tenant, and data class, so one compromised role cannot unwrap the whole business. Grant Decrypt to services, not to standing human roles.
  • Log and alert on key use. A service that normally unwraps ten DEKs an hour suddenly unwrapping ten thousand is your earliest exfiltration signal, but only if you watch the KMS.
  • Plan revocation before you need it. Know exactly which action makes a key un-callable and rehearse it, so a compromise is contained in minutes, not discovered in the post-mortem.
The permission that quietly defeats your encryption"Principal": "*", "Action": "kms:Decrypt" # any principal, no condition: the ciphertext is decorative

Encryption done well disappears into infrastructure; encryption done badly is a false sense of security wearing a compliance badge. Treat the key as the asset and the permission to call it as the control. You cannot govern keys for systems you have not inventoried, and shadow services with their own quiet KMS grants are exactly the ones nobody is watching.

Back to the knowledge baseRequest an assessment