Created
June 19, 2018 20:15
-
-
Save anibalsolon/f7586a85942792432e98470c512588b9 to your computer and use it in GitHub Desktop.
Instance profile w/ role to access all S3 buckets
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
#!/bin/bash | |
echo '{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { "Service": "ec2.amazonaws.com"}, | |
"Action": "sts:AssumeRole" | |
} | |
] | |
}' > /tmp/ec2-role-trust-policy.json | |
aws iam create-role --role-name nipype-pol --assume-role-policy-document /tmp/ec2-role-trust-policy.json | |
echo '{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": ["s3:*"], | |
"Resource": ["*"] | |
} | |
] | |
}' > /tmp/ec2-role-access-policy.json | |
aws iam put-role-policy --role-name nipype-pol --policy-name nipype-pol --policy-document /tmp/ec2-role-access-policy.json | |
aws iam create-instance-profile --instance-profile-name nipype-pol-profile | |
aws iam add-role-to-instance-profile --instance-profile-name nipype-pol-profile --role-name nipype-pol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment