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
#!/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.