Last active
February 7, 2020 17:21
-
-
Save cfbarbero/29b677cb736300ab6231787b9a6c99bf to your computer and use it in GitHub Desktop.
Create the OrganizationAccountAccessRole using the AWS CLI
This file contains hidden or 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 | |
if [ "$1" == "" ]; then | |
echo "Please set the ORGANIZATION ACCOUNT_ID as the first parameter" | |
fi | |
ACCOUNT_ID=$1 | |
aws iam create-role --role-name OrganizationAccountAccessRole --assume-role-policy-document %7B%0A%20%20%22Version%22%3A%20%222012-10-17%22%2C%0A%20%20%22Statement%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22Effect%22%3A%20%22Allow%22%2C%0A%20%20%20%20%20%20%22Principal%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22AWS%22%3A%20%22arn%3Aaws%3Aiam%3A%3A$ACCOUNT_ID%3Aroot%22%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22Action%22%3A%20%22sts%3AAssumeRole%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D | |
aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AdministratorAccess --role-name OrganizationAccountAccessRole |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment