Skip to content

Instantly share code, notes, and snippets.

@joekiller
Created August 21, 2019 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joekiller/61c5706e346d98e9b656c3fc974165da to your computer and use it in GitHub Desktop.
Save joekiller/61c5706e346d98e9b656c3fc974165da to your computer and use it in GitHub Desktop.
Nuke iam start-pipeline policies
for p in $(aws iam list-policies --query 'Policies[?starts_with(PolicyName, `start-pipeline`) == `true`].Arn' --output text); do
for v in $(aws iam list-policy-versions --policy-arn $p --query 'Versions[?IsDefaultVersion == `false`].VersionId' --output text); do
aws iam delete-policy-version --policy-arn $p --version-id $v
done
aws iam delete-policy --policy-arn $p
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment