Skip to content

Instantly share code, notes, and snippets.

@weyderfs
Created July 7, 2022 19:07
Show Gist options
  • Save weyderfs/9f42e5a207293aa3578506e7417236b5 to your computer and use it in GitHub Desktop.
Save weyderfs/9f42e5a207293aa3578506e7417236b5 to your computer and use it in GitHub Desktop.
List and Delete all customer managed AWS IAM Policies
#!/bin/sh
customer_managed_policy_arns=`aws iam list-policies --scope Local --query 'Policies[*].Arn' --output text`
for arn in $customer_managed_policy_arns; do
echo aws iam delete-policy --policy-arn "$arn" #To delete re-run without "echo"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment