Using Console
Using CLI
<user-name>
with the name of the IAM user or role that needs to manage the KMS key, and <policy-arn>
with the ARN of the new IAM policy.Step 4: Remove the KMS key administrator permissions from the existing IAM users or rolesUse the following command to remove the KMS key administrator permissions from the existing IAM users or roles:<key-id>
with the ID of the KMS key, and <grant-id>
with the ID of the grant that needs to be revoked.Repeat this command for each grant that needs to be revoked.By following these steps, you can remediate the misconfiguration of KMS key policies that should be designed to limit the number of KMS admins for AWS.Using Python
boto3
library in Python to list all the KMS keys and their key policies.put_key_policy
method to update the key policy.KeyId
with the ID of the KMS key that you want to update, and replace the AWS
ARNs with the ARNs of the IAM users who should have KMS admin permissions.