Created
November 29, 2013 16:05
-
-
Save tmaslen/7707903 to your computer and use it in GitHub Desktop.
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 BBC.AWS.CloudFormation | |
from BBC.AWS.CloudFormation import SQS, IAM | |
from BBC.AWS.CloudFormation.Common.ResourcePermissions import SQSActions | |
try: import json | |
except ImportError: import simplejson as json | |
template = BBC.AWS.CloudFormation.Template() | |
template.description = ( | |
"Create a user for the foo service" | |
) | |
resource_name = template.parameter( | |
"SomeSqsArn", | |
param_type="String", | |
description="Resource ARN of SQS" | |
) | |
foo_policy = IAM.Policy("NewsVisJUserSomeQueue") | |
foo_policy.add_rule("sqs", "Allow", SQSActions.publish, arn=resource_name) | |
foo_user = IAM.User("NewsVisJ") | |
foo_user.add_policy(foo_policy) | |
template.attach(foo_user) | |
template.output( | |
"NewsVisJUser", | |
foo_user.id(), | |
"The user for NewsVisJ to be able to push to sqs" | |
) | |
print json.dumps(template.render(), indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment