Skip to main content

CancelKeyDeletion

Cancels the deletion of a KMS key.

Description

The `CancelKeyDeletion` operation cancels the deletion of a KMS key. When this operation succeeds, the key state changes to `Disabled`. To enable the key, you must use the `EnableKey` operation.

This operation is part of the key deletion process. For more information about deleting keys, see Deleting Keys.

note
  • The KMS key that you use for this operation must be in a compatible key state. For details, see Key states required for operations.
  • After a key deletion is canceled, the key is still disabled. You must enable it before you can use it again.

Request Syntax

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.CancelKeyDeletion"Yesstring

Request Body

NameDescriptionRequiredType
KeyIdThe unique identifier of the KMS key whose deletion you want to cancel. This value can be the key ID or the key ARN of the KMS key.Yesstring
POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CancelKeyDeletion
{ "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab" }
Values in italics indicate user input and should be replaced with actual values.

Response Elements

NameDescriptionRequiredType
KeyIdThe Amazon Resource Name (ARN) of the KMS key whose deletion was canceled.NoString

Examples

Example 1: Cancel deletion of a KMS key

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CancelKeyDeletion
{ "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab" }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "KeyId": "arn:aws:verenc:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" }
Values in italics indicate variable response values.

Special Errors

Error CodeDescription
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
InvalidArnExceptionThe key ARN provided is not valid.
KMSInternalExceptionAn internal error occurred.
KMSInvalidStateExceptionThe request was rejected because the key state is not valid for this operation.
NotFoundExceptionThe request was rejected because the specified key was not found.

Permissions

To use the `CancelKeyDeletion` operation, you must have the following permissions:

  • `kms:CancelKeyDeletion` on the KMS key (specified in the policy)

Try It Out

Test CancelKeyDeletion

Cancel the scheduled deletion of a KMS key.

Coming Soon

This feature is currently under development and will be available soon.