Lesson 4 of 6 AWS KMS and CloudHSM

Rotating KMS Keys Without Breaking Access to Data

This lesson explains how rotation replaces a key's cryptographic material on a schedule, limiting how much data any one version protects, without breaking access to existing data.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the rotation options for each key type.
  • Explain how automatic rotation keeps existing data readable.
  • Explain how keys are rotated manually through an alias.

Rotation options

Key rotation replaces the cryptographic material behind a key, and how it works depends on the type of key. For a customer managed symmetric key, automatic rotation can be enabled, every 365 days by default or any period from 90 to 2,560 days, and the key can also be rotated immediately on demand. The key keeps the same ID and ARN, older material is retained so existing data still decrypts, and nothing needs to be re-encrypted. AWS managed keys rotate automatically every year, and this cannot be changed.

Symmetric keys with imported key material cannot rotate automatically, but since June 2025 they can be rotated on demand: new key material is imported into the same key and RotateKeyOnDemand makes it current, keeping the key ID and the older material, up to 25 times per key. Asymmetric and HMAC keys, and keys in custom key stores, cannot rotate at all; they are rotated manually by creating a new key and pointing the application's alias at it, keeping the old key for decrypting existing data. The following table summarises the options.

KeyRotation
Customer managed symmetricAutomatic every 365 days by default (90 to 2,560 configurable), and on demand
AWS managedAutomatic every year; cannot be changed
Symmetric, with imported materialOn demand after importing new material (up to 25 times); no automatic rotation
Asymmetric, HMAC, custom key storesManual: create a new key and update the alias
Sort into groups

How does this key rotate?

Exam skills 1.3.7

Decide how each kind of KMS key is rotated.

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

How automatic rotation works

Automatic rotation replaces a key's cryptographic material on a schedule without affecting applications or existing data. The key ID, ARN, aliases and key policy all stay the same, so applications need no changes.

KMS keeps every previous version of the key material for as long as the key exists, so data encrypted before a rotation still decrypts and nothing needs to be re-encrypted. New encryptions automatically use the latest material. Customer managed keys can rotate automatically on a period the customer chooses, and on demand, while AWS managed keys rotate every year.

The following diagram shows a key after two rotations.

Automatic rotation of a KMS key. The key ID, ARN, aliases and key policy stay the same. Each rotation adds new key material, which is used for new encryptions, while KMS keeps every earlier version so that data encrypted before the rotation still decrypts without being re-encrypted.
The number of rotations is illustrative. KMS chooses the right material for each decryption automatically.

Manual rotation

Keys that support no rotation at all, such as asymmetric keys, HMAC keys and keys in custom key stores, are rotated manually by replacing the whole key. The procedure relies on aliases.

  1. Create a new key

    Create a new KMS key.

  2. Move the alias

    Point the alias that applications use at the new key, so new encryptions use it.

  3. Handle the old key

    Keep the old key enabled so that existing data still decrypts, or re-encrypt the existing data with the new key and then disable and eventually delete the old one.

Applications that refer to keys by alias switch to the new key without code changes, which is a reason always to reference keys by alias.

Put in order

Rotating a key manually

Exam skills 1.3.7

Put the steps of rotating a key manually in order.

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

Meeting an annual rotation policy

An annual key rotation requirement is met differently depending on the type of key. The following table describes the rotation approach for each key.

KeyRotation approach
Customer managed symmetric key for S3 and RDSEnable automatic rotation every 365 days; no application changes
Key with imported material required by the regulatorEach year, import new key material into the same key and rotate it on demand
Asymmetric signing keyCreate a new key, publish its public key, move the alias, keep the old public key for verifying old signatures

Automatic rotation keeps old key material, so nothing is re-encrypted. For manual rotation, the old key stays enabled until no data depends on it.

Check yourself

After automatic rotation, how is data encrypted with the old key material decrypted?

Show answer

Automatically. KMS keeps all earlier key material for the key and selects the right one, and the key ID does not change.

Exam Tips

Remember for the exam

  • Automatic rotation needs no application changes, because the key ID stays the same.
  • Rotation does not require re-encrypting existing data.
  • Keys with imported material rotate on demand after new material is imported; asymmetric and HMAC keys are rotated by creating a new key and moving the alias.
  • A rotation period shorter than a year requires a customer managed key.