INNER CODE UNIT · Python
setup_iam_role
miztiik/AWS-Demos · how-to-examples/iam-s3-sqs-sns-video-transcoder.py:297
def setup_iam_role(self):
"""
Set up a new IAM role and set its policy to allow Elastic
Transcoder access to S3 and SNS. Returns the role.
"""
role = self.iam.create_role(
RoleName=self.role_name,
AssumeRolePolicyDocument=json.dumps(self.basic_role_policy))
self.iam.RolePolicy(self.role_name, 'more-permissions').put(
PolicyDocument=json.dumps(self.more_permissions_policy))
return role
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.