Lesson 1 of 6 AWS KMS and CloudHSM

Choosing AWS KMS Key Types

This lesson explains how AWS KMS creates and controls the keys that encrypt data across AWS services, which is central to almost every question about encryption at rest.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish AWS owned, AWS managed and customer managed keys.
  • Describe how KMS protects and audits key use.
  • Identify the key store options.
  • Choose a key type from the control a question requires.

Key types

KMS keys are classified by who creates and controls them. AWS owned keys belong to AWS and are used internally by some services, such as DynamoDB, to encrypt data by default; they are invisible in your account, cost nothing and cannot be audited or managed. AWS managed keys, with aliases such as aws/s3, are created in your account the first time a service needs one. Their use is logged in CloudTrail and they rotate every year, but their key policy cannot be changed, so they cannot be shared with other accounts.

Customer managed keys are created and controlled by you: you write the key policy, grant access to other accounts, choose the rotation period, and can disable or schedule deletion of the key. They have a monthly fee plus request charges, and they are required whenever an architecture must control or audit access to the key itself, or share encrypted data across accounts. The following table summarises the three types.

TypeControlNotes
AWS ownedAWS, internalInvisible to you; used by default in some services, such as DynamoDB
AWS managed (aws/service)AWSCreated on first use, rotated yearly; policy cannot be changed or shared across accounts
Customer managedYou: policy, grants, rotation, deletionMonthly fee plus requests

Key specs: symmetric (AES-256, the default and the only kind AWS services use for encryption at rest), asymmetric (RSA, ECC) for signing or encryption outside AWS, and HMAC.

Protection and auditing

AWS KMS protects key material in hardware: keys are generated and used inside hardware security modules validated under FIPS 140-3, and key material never leaves them unencrypted, so nobody, including AWS operators, can export a plaintext key. Every use of a key is logged in AWS CloudTrail, which gives an audit trail of who encrypted or decrypted what, and when.

Keys have a lifecycle that must be managed carefully. A key can be disabled, which is reversible, or scheduled for deletion after a waiting period of 7 to 30 days; once deleted, any data encrypted under it is unrecoverable, which is why the waiting period exists. Aliases, such as alias/payments, give keys friendly names that applications use, so the key behind an alias can change without code changes.

Key stores

The key store decides where the key material behind a KMS key is held. By default, it is kept in KMS's own hardware security modules (HSMs), which are validated to FIPS 140 and managed entirely by AWS; this suits almost every workload.

A custom key store backed by CloudHSM keeps the key material in a CloudHSM cluster that you own and that is single-tenant, while applications still use the normal KMS APIs and service integrations. It suits regulations that require keys in HSMs under your sole control, but you must keep the cluster running, with HSMs in at least two Availability Zones. An external key store keeps the key material in an HSM outside AWS, reached through a proxy, so the keys never exist in AWS at all; availability and latency then depend on your own infrastructure. The following table summarises the options.

Key storeKey material held in
DefaultKMS's own HSMs
Custom key store (CloudHSM)Your CloudHSM cluster
External key storeAn HSM outside AWS
Match the pairs

Key stores

Exam skills 1.3.2 · 1.3.1

Match each requirement with the KMS key store that meets it.

Log in to try this activity Interactive activities are free with an account.

In architecture questions

Most AWS services encrypt data at rest with a single setting, and the choice of key type is usually the deciding detail in a question. AWS managed keys require no management but give no control over their policy or rotation. When a question stresses an audit trail of key usage under the customer's control, control over exactly who can decrypt, separation of duties between key administrators and key users, cross-account sharing of encrypted data, or a custom rotation schedule, the answer is a customer managed key.

Select all that apply

When a customer managed key is needed

Exam skills 1.3.2 · 1.3.4

Identify the requirements that point to a customer managed KMS key.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing a key type

The appropriate type of KMS key depends on the level of control required. The following table identifies the key suited to several requirements.

RequirementKey choice
Encrypt S3 data with no management effortSSE-S3 or the AWS managed key aws/s3
Control who can decrypt and audit every useCustomer managed key with a key policy
Share encrypted snapshots with another accountCustomer managed key (AWS managed keys cannot be shared)
Disable all access to the data instantly in an emergencyCustomer managed key: disable it
Rotate key material every year automaticallyCustomer managed key with automatic rotation (AWS managed keys rotate too)

Most architecture questions that mention control, auditing, sharing or disabling point to a customer managed key. When none of those matter, the simplest default encryption is the answer.

Check yourself

What is the difference between AWS owned keys and AWS managed keys?

Show answer

AWS owned keys are used by services from AWS's own accounts and are not visible to you. AWS managed keys (aws/service) are in your account and appear in KMS and CloudTrail, but you cannot change their policies or rotation.

Exam Tips

Remember for the exam

  • When you need control over key policy, rotation or cross-account sharing, use a customer managed key.
  • If a key deletion was scheduled by accident, cancel it during the 7- to 30-day waiting period.
  • For separation of duties over who can decrypt data, use a customer managed key with a restrictive key policy.
  • To switch to a new key without changing code, update the alias.