Skip to content

Instantly share code, notes, and snippets.

@tmaslen
Created Nov 29, 2013
Embed
What would you like to do?
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