Skip to content

Instantly share code, notes, and snippets.

@jplazcano87
Created November 6, 2015 16:27
Show Gist options
  • Save jplazcano87/b8d51655bded32f0dfe0 to your computer and use it in GitHub Desktop.
Save jplazcano87/b8d51655bded32f0dfe0 to your computer and use it in GitHub Desktop.
Create, Publish and Subscribe Users to AWS SNS topics
import boto.sns
import logging
logging.basicConfig(filename="sns-publish.log", level=logging.DEBUG)
c = boto.sns.connect_to_region("us-east-1")
topicarn = "$TOPIC_ARN"
message = "hello Mr"
message_subject = "trialBotoTRopic"
publication = c.publish(topicarn, message, subject=message_subject)
print publication
import boto.sns
import logging
logging.basicConfig(filename="sns-email-sub.log", level=logging.DEBUG)
c = boto.sns.connect_to_region("us-east-1")
topicarn = "$TOPIC_ARN"
emailaddress1 = "some email"
emailaddress2 = "some other email"
subscription1 = c.subscribe(topicarn, "email", emailaddress1)
subscription2 = c.subscribe(topicarn, "email", emailaddress2)
print subscription1
print subscription2
import boto.sns
import logging
logging.basicConfig(filename="sns-topic.log", level=logging.DEBUG)
c = boto.sns.connect_to_region("us-east-1")
topicname = "trialBotoTRopic"
topicarn = c.create_topic(topicname)
print topicname, "has been successfully created with a topic ARN of", topicarn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment