I am trying to delete all of my customer managed policies but I am not able to figure out a way to delete all of them in one click or using only one command
Is there a way to delete a number of AWS IAM customer managed policies in one shot using CLI or GUI?
Asked
Active
Viewed 278 times
1 Answers
2
#!/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"
done
Make sure you delete echo
after you confirm all the commands you are expecting it to run.

jellycsc
- 10,904
- 2
- 15
- 32