AWS Builder Center
AWS Key Management Service (KMS): Encryption Made Simple

AWS Key Management Service (KMS): Encryption Made Simple

A plain language look at how AWS KMS handles encryption keys for you.

Series: AWS Security 30 Days, 30 Articles Challenge (31 articles)

  1. …
  2. 10
    AWS Key Management Service (KMS): Encryption Made Simple This article
Welcome to Day 9 of the 30 Days AWS Security Challenge. Yesterday we mentioned encryption a few times while talking about S3. Today we go straight to the service that sits behind almost all encryption on AWS: Key Management Service, or KMS.

What Encryption Keys Actually Do

Encryption turns readable data into scrambled data, and a key is what makes that scrambling reversible. Without the right key, encrypted data is just noise. With it, the data decrypts back to its original, readable form. The entire security of encryption comes down to how well you protect that key, since anyone holding it can unlock the data it protects.
This creates an obvious problem: if you need to protect the key just as carefully as the data itself, where does the key live, and who manages it? That is exactly the job KMS was built for.

What KMS Does for You

KMS is a managed service for creating, storing, and controlling access to encryption keys, without you having to build or run any of that infrastructure yourself. Instead of managing key files on a server somewhere, you create a key inside KMS, and AWS handles the storage and the underlying cryptographic operations.
Just as importantly, KMS integrates directly with most other AWS services. When you enable encryption on an S3 bucket, an EBS volume, or an RDS database, you are usually choosing a KMS key behind the scenes to do the actual encrypting and decrypting.

The Two Kinds of Keys You'll Run Into

KMS gives you two main options for keys:
  • AWS managed keys, created and managed automatically by AWS for a specific service, like the default key used when you enable S3 bucket encryption without picking your own key. You don't control the key policy directly, but it works out of the box with no setup.
  • Customer managed keys, created by you, where you control the key policy, decide exactly who can use it, and can rotate or disable it on your own schedule.
For most beginner setups, AWS managed keys are perfectly fine. Once you need finer control over who can use a key, or you need to share encrypted data across accounts, customer managed keys become worth the extra setup.

How KMS Controls Access

Every KMS key has its own key policy, which works similarly to the IAM and bucket policies we've already covered. It defines who is allowed to use the key, and for what, like encrypting data, decrypting data, or managing the key itself.
This means access to encrypted data effectively requires two separate approvals: permission to access the resource (like an S3 object), and permission to use the key that encrypts it. This double layer is a real security benefit, since compromising one alone is not enough to read the data.

A Simple Example

Say you want to create your own key to encrypt a sensitive DynamoDB table. In the console, you would go to KMS > Customer managed keys > Create key, choose a symmetric key for general encryption use, and define who can administer and who can use the key in the key policy step. Once created, you can select that key when configuring encryption on your DynamoDB table, instead of relying on the AWS managed default.

Key Rotation

One underrated feature of customer managed keys is automatic key rotation, which generates new cryptographic material behind the scenes on a yearly schedule without requiring you to re-encrypt existing data or update anything in your applications. You can enable this from the key's settings, and it is a low effort way to reduce long term risk from a key that might be exposed over time.

Key Takeaways

  • Encryption relies entirely on keeping the encryption key safe, and KMS exists to manage that safely for you
  • AWS managed keys work out of the box, customer managed keys give you full control over policy and rotation
  • KMS integrates directly with services like S3, EBS, and RDS, encrypting data behind the scenes
  • Key policies add a second layer of access control on top of the resource itself
  • Enable automatic key rotation on customer managed keys for an easy, low effort security improvement
Tomorrow we build directly on this and look at the bigger picture of encrypting data both at rest and in transit across AWS.

Series: AWS Security 30 Days, 30 Articles Challenge (31 articles)

  1. …
  2. 10
    AWS Key Management Service (KMS): Encryption Made Simple This article
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