Using Console
Using CLI
list-policies
to list all the policies in your AWS account.
get-policy-version
. Replace <policy-arn>
with the ARN of the policy you want to retrieve.
Document
field value from the command output, as it contains the policy document.
NotAction
field from each statement that contains it.
For example, if the policy document looks like this:
NotAction
field:
create-policy-version
. Replace <policy-arn>
with the ARN of the policy you want to update, and <modified-policy-document>
with the path to the modified policy document JSON file.
get-policy-version
. Replace <policy-arn>
with the ARN of the policy you updated.
Document
field in the output matches the modified policy document.
Using Python
pip install boto3
aws configure
and provide the access key, secret access key, and region.remediate_policies.py
.python remediate_policies.py
.