Xóa CMK là một thao tác rất nhạy cảm. Bạn chỉ nên xóa CMK khi chắc chắn rằng mình không cần sử dụng nữa.
aws kms disable-key --key-id <key ID of the CMK we want to disable>
2. Để kiểm tra chúng ta truy cập KMS Console
aws kms enable-key --key-id <key ID of the CMK we want to enable>
4. Để kiểm tra chúng ta truy cập KMS Console
AWS không cho phép xóa CMK ngay lập tức mà yêu cầu lập lịch cho nhiệm vụ này, với khoảng thời gian chờ ít nhất là 7 ngày và nhiều nhất là 30 ngày (default). Bạn có thể thiết lập lại thời gian chờ cho tới khi CMK chính thức được xóa bằng parameter pending-window-in-days.
aws kms schedule-key-deletion --key-id <key ID of the CMK we created in section 3.1> --pending-window-in-days 7
2. Để kiểm tra chúng ta truy cập KMS Console
Với CMK tạo bởi External Key Material thì sẽ hơi khác một chút, bởi ngoài việc lập lịch xóa CMK, ta còn phải thực hiện xóa External Key Material hoặc thiết lập thời gian để Key Material bị expired.
aws kms delete-imported-key-material --key-id <key ID of the CMK we created in section 3.2>
2. Để kiểm tra chúng ta truy cập KMS Console
aws kms schedule-key-deletion --key-id <key ID of the CMK we created in section 3.2> --pending-window-in-days 7
4. Để kiểm tra chúng ta truy cập KMS Console