Last active
January 8, 2018 21:23
-
-
Save alexturek/253d25829c21a3f902fd387b30fcc223 to your computer and use it in GitHub Desktop.
Deletes all SNS topics prefixed with `test-`. Requires `parallel` and `awscli`
This file contains hidden or 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
#!/usr/bin/env bash | |
# Run these first so you have the list of test topics, and you know what you're about to delete | |
aws sns list-topics | jq -r .Topics[].TopicArn > topics | |
grep ":test-[[:digit:]]*-" topics > test-topics | |
sed -r 's/[[:digit:]]/X/g' test-topics | sort | uniq -c | |
# Actually delete topics: | |
parallel -j 20 rmtopic.sh < test-topics |
This file contains hidden or 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
#!/usr/bin/env bash | |
topic=$1 | |
echo $topic >> deleted-topics | |
aws sns delete-topic --topic-arn $topic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related: sqs