Created
May 3, 2019 01:26
-
-
Save CodySwannGT/99ba6e63b89a68ad1b8e4f4a5d527dfa to your computer and use it in GitHub Desktop.
Delete unattached customer managed AWS policies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while :; echo $(aws iam list-policies --no-only-attached --scope Local --output text --query 'Policies[?AttachmentCount==`0`]|[0:1].Arn'); do aws iam delete-policy --policy-arn $(aws iam list-policies --no-only-attached --scope Local --output text --query 'Policies[?AttachmentCount==`0`]|[0:1].Arn') || true; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment