Deleting Key

Last updated: 2023-08-24 15:52:37

Overview

The schedule key deletion feature involves the following two APIs:
API
API Description
Note
ScheduleKeyDeletion
Add scheduled key deletion task
The KeyId and PendingWindowInDays are mandatory parameters for this API operation. For more details, please refer to the ScheduleKeyDeletion interface.
CancelKeyDeletion
Cancel Scheduled Deletion Task
The KeyId is a required parameter for this API operation. For more details, please refer to the CancelKeyDeletion interface documentation.
Note
If a CMK schedule deletion waiting period is set through the ScheduleKeyDeletion API when the CMK is in disabled status, the CMK will be deleted automatically at the specified time.
This example uses Tencent Cloud's Command Line Tool TCCLI. You can use any supported programming language for subsequent calls.

Sample

Creating a scheduled deletion task example

This example shows you how to delete a disabled CMK in 7 days.

Input

tccli kms ScheduleKeyDeletion --region ap-guangzhou --KeyId 5xxxxx-xxxx-xxxx-xxxx-52xxxxx4 --PendingWindowInDays 7

Output

If the setting is successful, the ID of the CMK to be deleted and the schedule deletion timestamp will be returned.
{
"KeyId": "6xxxxxxx-xxxx-xxxx-xxxx-5xxxxxxxxc09",
"RequestId": "2bd72d85-f9dd-4465-ae51-beebff54f540",
"DeletionDate": 1572512542
}

Canceling a scheduled deletion task example

This example shows you how to cancel a schedule deletion task, where the CMK is the one used in the above example.

Input

tccli kms CancelKeyDeletion --region ap-guangzhou --KeyId 5xxxxx-xxxx-xxxx-xxxx-52xxxxx

Output

If the execution is successful, the returned request will contain the ID of the CMK for which the schedule deletion task is successfully canceled.
{
"KeyId": "6xxxxxxx-xxxx-xxxx-xxxx-5xxxxxxxxc09",
"RequestId": "c85473c6-e18d-4a09-9eac-03958dd4714d"
}