Using Console
Using CLI
<key-id>
with the Key ID of the KMS key that you want to remediate.<key-id>
with the Key ID of the KMS key that you remediated. This command should return an empty policy.Using Python
aws kms list-keys
to list all the KMS keys in your AWS account. Then, you can use the aws kms describe-key
command to get the details of each key and check if any of them are exposed.Step 2: Revoke the key policy that is exposing the KMS key.You can use the aws kms put-key-policy
command to revoke the key policy that is exposing the KMS key. Here’s an example of how you can do it: