Disabling and Deleting KMS Keys Safely
This lesson explains why KMS makes key deletion deliberate and delayed, and offers disabling as a reversible alternative, since deleting a key makes every piece of data encrypted under it permanently unreadable.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish disabling a key from scheduling its deletion.
- Describe safe practices before deleting a key.
- Explain how deleting imported key material differs.
- Alarm on attempts to use a key that is pending deletion.
Disable or delete
Disabling and deleting a key have very different consequences. A disabled key cannot be used for any cryptographic operation, but it can be enabled again at any time, so disabling is a safe way to cut off access or to test whether anything still depends on a key. Scheduling deletion makes the key unusable at once and starts a waiting period of 7 to 30 days, during which the deletion can be cancelled. A CloudWatch alarm on attempts to use the key during this period reveals forgotten dependencies. Once deletion completes, every piece of data encrypted under the key is permanently unrecoverable. The following table summarises the actions.
| Action | Effect | Reversible |
|---|---|---|
| Disable | The key cannot be used until it is enabled again | Yes |
| Schedule deletion | The key is unusable during a 7 to 30 day waiting period, then deleted | Yes, during the waiting period |
| Deletion completes | Data encrypted under the key is permanently unrecoverable | No |
7–30days
Waiting period before a scheduled key deletion completes
Disable or delete?
Safe practice
Deleting a KMS key is irreversible: all data encrypted under it becomes permanently unreadable. Because data may have been encrypted under a key by applications or services that nobody remembers, the main risk is deleting a key that is still in use. Disabling a key is reversible and shows the same failures as deletion would, so it serves as a test. The following list describes the recommended practices.
- Disable a key first and watch for failures before scheduling deletion.
- Use the maximum 30-day waiting period.
- Alarm on CloudTrail events for
ScheduleKeyDeletionandDisableKey. - Alarm on attempts to use a key pending deletion, which prove it is still needed.
- Restrict
kms:ScheduleKeyDeletionto a small group, and consider an SCP that denies it except to a security role.
The following diagram shows the waiting period before a KMS key is deleted and the two safeguards that catch a deletion that would destroy data.

Deleting keys safely
Deleting imported key material
Keys with imported material behave differently: the material can be deleted immediately, with no waiting period, and access is restored by importing the same material again. This suits organisations that need an instant way to make data unreadable while keeping an escrow copy.
Catching a dangerous key deletion
An administrator schedules a key for deletion, believing it unused. If any data still depends on it, that data will be lost for ever when the waiting period ends. First, an EventBridge rule alerts the moment deletion is scheduled:
{
"source": ["aws.kms"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": { "eventSource": ["kms.amazonaws.com"], "eventName": ["ScheduleKeyDeletion", "DisableKey"] }
}Second, a CloudWatch Logs metric filter on the trail counts attempts to use a key that is pending deletion, which KMS logs as failed calls with KMSInvalidStateException. Any such attempt proves the key is still needed, and the deletion is cancelled:
aws kms cancel-key-deletion --key-id 1234abcd-12ab-34cd-56ef-1234567890ab
aws kms enable-key --key-id 1234abcd-12ab-34cd-56ef-1234567890abHow can the impact of deleting a key be tested safely first?
Show answer
By disabling the key, which can be reversed, and watching what fails.
Exam Tips
Remember for the exam
- If a key is scheduled for deletion by mistake, cancel the deletion during the 7- to 30-day waiting period.
- To test the impact before deleting a key, disable it first.
- After deletion, data encrypted under the key cannot be recovered.
- Alarm on ScheduleKeyDeletion and on attempts to use keys pending deletion.
- Imported key material can be deleted immediately and re-imported later.