INNER CODE UNIT · Python
get_sns_topic
miztiik/AWS-Demos · how-to-examples/iam-s3-sqs-sns-video-transcoder.py:309
def get_sns_topic(self):
"""
Get or create the SNS topic.
"""
# Creating a topic is idempotent, so if it already exists
# then we will just get the topic returned.
return self.sns.create_topic(Name=self.topic_name).arn
def get_sqs_queue(self):
"""
Get or create the SQS queue. If it is created, then it is
also subscribed to the SNS topic, and a policy is set to allow
the SNS topic to send messages to the queue.
"""
# Creating a queue is idempotent, so if it already exists
# then we will just get the queue returned.
queue = self.sqs.create_queue(QueueName=self.queue_name)
self.queue_arn = queue.attributes['QueueArn']