Skip to Content
Asterrr's Handbook
5 · Data protection

KMS rotation and imported key material

Automatic, on-demand and manual rotation, rotation periods, and bring-your-own-key material compared with KMS-generated material.

Exam tasks: 5.3.2 (import and remove key material), 5.3.3 (AWS generated key material, imported versus AWS generated key material)

The decision: does the key material rotate itself, or do you import, expire and replace it yourself?

Rotation replaces the key material behind a KMS key. The key ID, ARN, aliases and policies stay the same. Old material is kept so old ciphertext still decrypts. Rotation does not re-encrypt data and does not rotate data keys.

get paramsdownloadimport wrappedKMS key,EXTERNALWrapping keyYour HSMMaterial in KMS
Import flow. The key material is wrapped with a KMS public key before it leaves your HSM, and only unwrapped inside KMS HSMs.

Rotation options

OptionApplies toDetail
AutomaticCustomer managed symmetric keys with KMS-generated materialOff by default. Default every 365 days. Custom period 90 to 2,560 days
On-demandSame keys, plus symmetric keys with imported material (after you import new material)Up to 25 times per key. Does not change the automatic schedule. Needs kms:RotateKeyOnDemand
ManualAsymmetric, HMAC, custom key store keys, or any key you replaceCreate a new key and repoint the alias with UpdateAlias
AWS managed keysaws/<service>Always on, about every 365 days. You cannot change it
AWS owned keysService internalThe service decides
  • Multi-Region keys with KMS-generated material rotate from the primary. The setting and the new material copy to every replica.
  • While a key is disabled or Pending deletion, rotation pauses. If a rotation date was missed, KMS rotates right after it is re-enabled or deletion is cancelled.
  • The condition key kms:RotationPeriodInDays lets a key policy cap the period callers choose.
  • KMS writes a RotateKey event to CloudTrail and an event to EventBridge when it rotates.
  • Manual rotation means a new key ID. Keep the old key enabled, or old ciphertext stops decrypting, and repoint aliases and applications.
  • Rotation changes what new encryptions use. It never re-encrypts existing data and does not rotate data keys.

Legacy

Before May 2022, AWS managed keys rotated every three years and customer managed keys had a fixed one-year period with no on-demand option. Older guides still repeat this.

Generated vs imported

AWS generated (AWS_KMS)Imported (EXTERNAL)
Who creates the materialKMS HSMsYou, with your own entropy source
Key typesSymmetric, asymmetric, HMACSymmetric, asymmetric (except ML-DSA), HMAC
Automatic rotationYes (symmetric)No
On-demand rotationYesYes, after you import new material (symmetric only)
ExpirationNeverOptional expiry date you choose
Remove material without deleting the keyNot possibleDeleteImportedKeyMaterial, effective at once
Waiting period to destroy7–30 days (delete the key)None for the material; reimport restores it
DurabilityAWSYou: lose your copy after it expires and the data is gone
Custom key storesSupportedNot supported
Multi-RegionMaterial copied to replicas by KMSYou import the same material into each replica
  • Symmetric, asymmetric (not ML-DSA or ML-KEM) and HMAC keys can take imported material.
  • Reasons to import are proving the entropy source, keeping a copy outside AWS, meeting a root-of-trust rule, or using expiry and instant removal.
  • Reimport must use the same material. The ciphertext is bound to the KMS key, not only the material. If you delete the KMS key, importing the same material into a new key does not decrypt old data. Keep the key and remove only the material.

Exam signal

"We must be able to make the data unreadable immediately, and restore access later" means imported key material: delete the material now, reimport the same material later. Scheduling key deletion can't be undone after the waiting period, and disabling a key leaves the material inside AWS.

Exam signal

"Rotate with no operational work" means generated material with automatic rotation.

Exam trap

Rotation does not protect a leaked data key and does not re-encrypt existing objects. Asymmetric keys do not auto-rotate. The answer is a new key plus an alias update.

Imported key material (BYOK)

How import works

Create a key with no material. CreateKey with origin EXTERNAL. The key sits in PendingImport.

Download the wrapping public key and import token. GetParametersForImport returns an RSA public key and a token that are valid for 24 hours.

Wrap your material. Encrypt it with the public key using RSAES-OAEP or RSA-AES key wrap, on your own HSM.

Import. ImportKeyMaterial with the token, the wrapped material and an optional expiration time.

  • The ciphertext is bound to the KMS key, not just the material. If you delete the KMS key, importing the same material into a new key doesn't decrypt old data. Keep the key; only remove the material.
  • Only the same material can be reimported into a key, unless you are staging new material for on-demand rotation.
  • Set a CloudWatch alarm on the SecondsUntilKeyMaterialExpiration metric so an expiry doesn't surprise you.
  • When imported material expires or is deleted, the key becomes unusable. AWS services that cached a data key (an attached EBS volume, for example) keep working until the data key is needed again.

Rotating imported material

  1. Generate new material and import it into the same key. It shows as pending rotation.
  2. Call RotateKeyOnDemand. New encryptions use the new material, and old ciphertext still decrypts with the old material, which stays attached to the key.
  3. Every material version must stay present and unexpired. Losing any of them makes the whole key unusable.

Rotating BYOK the old way

Older material taught "create a new KMS key, import new material, move the alias" as the only way to rotate imported keys. That still works, but it leaves a second key to manage and applications that stored the key ARN break. On-demand rotation of imported material now keeps the same key ID.

Scenarios

Scenario
A bank imported 256-bit key material into a symmetric KMS key two years ago. Its policy now requires the key material to change every year without changing the key ARN that dozens of applications reference. What should the security engineer do?

Further reading

On this page