Lesson 2 of 8 AWS KMS and AWS CloudHSM

Rotating KMS Key Material

This lesson explains the automatic, on-demand and manual rotation options in KMS, which limit the amount of data protected by any one key material and are often required by compliance frameworks.

Learning outcomes

After completing this lesson, you will be able to:

  • Choose between automatic, on-demand and manual rotation.
  • Explain what rotation does and does not do to existing ciphertext.
  • Describe how rotation status is audited across an organisation.

Rotation options

Key rotation replaces a key's cryptographic material, and there are three ways to do it. Automatic rotation applies to symmetric customer managed keys whose material KMS generated. KMS creates new material on a schedule you set, from 90 to 2,560 days (365 by default). The key ID, ARN and policy stay the same, so nothing that uses the key needs to change, and KMS keeps the old material to decrypt data encrypted earlier. On-demand rotation rotates immediately, for example after a suspected compromise, for keys with AWS-generated or imported material.

Manual rotation is used for key types that cannot rotate automatically, such as asymmetric keys. You create a new key and move the alias that applications use to point to it. Because the new key is a different key, the old one must be kept to decrypt existing ciphertext. The following table summarises the options.

MethodHow it works
AutomaticSymmetric customer managed keys with AWS-generated material; new material every 90 to 2,560 days (default 365). Key ID, ARN and policy unchanged; old material kept to decrypt existing data
On demandRotate immediately, for example after a suspected compromise; available for keys with AWS-generated or imported material
ManualCreate a new key and move an alias; for key types that cannot rotate automatically. Old ciphertext still needs the old key

90–2,560days

Range of the automatic rotation period

365days

Default automatic rotation period

Fill in the number

Rotation periods

Exam skills 5.3.5

Answer from the KMS automatic rotation limits.

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

What rotation does and does not do

Rotation is often misunderstood. The following list describes its effects.

  • New encryptions use the new material; existing ciphertext is not re-encrypted.
  • Decryption still works for data encrypted with older material, which KMS keeps.
  • AWS managed keys rotate automatically every year; asymmetric and HMAC keys, and keys in custom key stores, do not rotate automatically.
  • Applications that reference an alias need no change when the alias is moved to a new key.

The following diagram shows key material changing under one key ID as a KMS key is rotated automatically.

Automatic key rotation every 180 days. New key material is added on schedule while the key ID stays the same, so applications need no change and older ciphertext still decrypts; rotate-key-on-demand adds material at once after a suspected compromise, and an AWS Config rule reports any key with rotation off.
The scenario is illustrative.
True or false

What rotation changes

Exam skills 5.3.5

Check what happens when a KMS key is rotated.

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

Auditing rotation

GetKeyRotationStatus and ListKeyRotations show whether rotation is enabled and when it happened, and the Config rule cmk-backing-key-rotation-enabled reports customer managed keys without automatic rotation.

Worked example

Meeting a 180-day rotation requirement

A compliance standard requires key material to change at least every 180 days. Automatic rotation is enabled with that period on every customer managed key:

aws kms enable-key-rotation --key-id 1234abcd-12ab-34cd-56ef-1234567890ab --rotation-period-in-days 180
aws kms get-key-rotation-status --key-id 1234abcd-12ab-34cd-56ef-1234567890ab
aws kms list-key-rotations --key-id 1234abcd-12ab-34cd-56ef-1234567890ab

Applications keep using the same key ID, and older ciphertext still decrypts. After a suspected compromise, rotate-key-on-demand creates new material immediately. The Config rule cmk-backing-key-rotation-enabled reports any key where rotation is off, providing evidence for the auditor.

Check yourself

When should a key be rotated on demand?

Show answer

After a suspected compromise, without waiting for the automatic schedule.

Exam Tips

Remember for the exam

  • To rotate without changing the key ID or re-encrypting data, use automatic rotation.
  • The rotation period can be set from 90 to 2,560 days.
  • Rotate on demand after a suspected compromise.
  • Keys that cannot rotate automatically are rotated manually by moving an alias to a new key.
  • Rotation does not re-encrypt existing data.