Last active
August 29, 2015 14:07
-
-
Save gene1wood/cc9d7e857f9114626b52 to your computer and use it in GitHub Desktop.
Code snipit to create the Security Monkey trusted IAM role
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.iam | |
conn_iam = boto.iam.connect_to_region('universal') | |
role_name='SecurityMonkeyInstanceProfile' | |
assume_role_policy_document = '''{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "", | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "ec2.amazonaws.com" | |
}, | |
"Action": "sts:AssumeRole" | |
} | |
] | |
}''' | |
policy_document = '''{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ses:SendEmail" | |
], | |
"Resource": "*" | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": "sts:AssumeRole", | |
"Resource": "*" | |
} | |
] | |
}''' | |
create_role_result = conn_iam.create_role(role_name=role_name, | |
assume_role_policy_document=assume_role_policy_document) | |
put_role_policy_result = conn_iam.put_role_policy(role_name=role_name, | |
policy_name="SecurityMonkeyLaunchPerms", | |
policy_document=policy_document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment