AWS Builder Center

AWS KMS: 6 Habits That Keep Your Encryption Keys Safe and Your Data Decryptable

Six small KMS habits I follow — customer managed keys, automatic rotation, tight key policies, and CloudTrail audit trails — that keep encryption boring and recovery possible.

Encryption is the part of AWS nobody thinks about until it breaks — and when KMS breaks, it breaks loudly: data you cannot decrypt, keys you cannot delete, or a bill full of keys nobody owns. I have made most of these mistakes already, so here are the six habits that keep my keys boring and my data recoverable.
1. Use customer managed keys for anything that matters AWS managed keys are fine for a quick experiment, but for real workloads I create customer managed keys. They give me control over the key policy, rotation, deletion, and who can use them — and I can see exactly which key protects which resource. If I cannot name the key protecting my production data, I do not really own its encryption.
2. Turn on automatic rotation — and verify it actually rotated Automatic rotation is one toggle, and it is the easiest security win in KMS. A rotated key keeps decrypting old data, because KMS keeps the old key material for decryption while new data uses the new material. My habit is to check once a quarter that rotation is on for every production key, because a key created in a hurry often has it off.
3. Scope key policies tightly, and separate encrypt from decrypt A key policy that allows kms:* to everyone in the account is barely a policy. I grant kms:Encrypt to the services that write data and kms:Decrypt only to the roles that genuinely read it, and I add kms:ViaService conditions so a key meant for S3 cannot be used from an unrelated service. Least privilege applies to keys just as much as to IAM roles.
4. Use aliases and grants, never hardcode key IDs in code Key IDs change when keys are replaced; aliases do not. I reference keys by alias per environment (alias/app-prod, alias/app-staging) and let services like S3 and Lambda use grants instead of handing out raw key permissions. When a key needs replacing, I repoint the alias instead of redeploying every service that touched the old ID.
5. Watch key usage in CloudTrail and alarm on the dangerous calls KMS logs every use to CloudTrail, which means I can actually see who decrypted what and when. I alarm on DisableKey, ScheduleKeyDeletion, and any sudden spike in decrypt calls, because those are the calls that precede an outage or an incident. Deleting a key has a 7 to 30 day waiting period — that window has saved me more than once, and I treat it as a safety net, not an annoyance.
6. Plan for key loss and region failure before you need to A key that only exists in one Region is a single point of failure for a multi-Region workload, so for anything with a disaster-recovery story I use multi-Region keys. I also keep a simple document listing which key protects which dataset and who owns each key, and I test a restore with a rotated key at least once. The worst time to discover a key problem is during an actual incident.
Key takeaways - Customer managed keys give you control over policy, rotation, and deletion; AWS managed keys are for experiments. - Automatic rotation is free security — turn it on and verify it quarterly. - Split encrypt and decrypt permissions, and bind keys to their intended service with kms:ViaService. - Aliases and grants make key replacement painless; hardcoded key IDs make it a redeploy. - Alarm on DisableKey and ScheduleKeyDeletion, and treat the deletion waiting period as your safety net. - Multi-Region keys and a tested restore plan turn encryption from a risk into a routine.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article