Created
November 6, 2015 16:27
-
-
Save jplazcano87/b8d51655bded32f0dfe0 to your computer and use it in GitHub Desktop.
Create, Publish and Subscribe Users to AWS SNS topics
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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