Skip to content

Instantly share code, notes, and snippets.

@rhenter
Last active August 17, 2017 11:43
Show Gist options
  • Save rhenter/174d91caefccd65c66fe0b7baf109a85 to your computer and use it in GitHub Desktop.
Save rhenter/174d91caefccd65c66fe0b7baf109a85 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import json
import boto3
def create_topics(topics):
client = boto3.client('sns')
results = []
for topic in topics:
topic = topic.replace('\n', '').strip()
results.append(client.create_topic(Name=topic))
with open('results.txt', 'w') as results_file:
results_file.write(json.dumps(results, indent=4))
if __name__ == '__main__':
with open('amazon_topics.txt', 'r') as topic_file:
topics = topic_file.readlines()
create_topics(topics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment