Skip to content

Instantly share code, notes, and snippets.

@alexturek
Last active January 8, 2018 21:23
Show Gist options
  • Save alexturek/253d25829c21a3f902fd387b30fcc223 to your computer and use it in GitHub Desktop.
Save alexturek/253d25829c21a3f902fd387b30fcc223 to your computer and use it in GitHub Desktop.
Deletes all SNS topics prefixed with `test-`. Requires `parallel` and `awscli`
#!/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
#!/usr/bin/env bash
topic=$1
echo $topic >> deleted-topics
aws sns delete-topic --topic-arn $topic
@alexturek
Copy link
Author

Related: sqs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment