Created
November 16, 2015 15:06
-
-
Save tkuchiki/6b65451f76f23c73152e to your computer and use it in GitHub Desktop.
aws iam で instance proflie を設定する
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 | |
| cd $(dirname ${0}) | |
| PROFILE_NAME="test-profile" | |
| ROLE_NAME="test-role" | |
| POLICY_ARN="arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess" | |
| aws iam create-instance-profile --instance-profile-name ${PROFILE_NAME} | |
| aws iam create-role --role-name ${ROLE_NAME} --assume-role-policy-document file://role.json | |
| aws iam attach-role-policy --role-name ${ROLE_NAME} --policy-arn ${POLICY_ARN} | |
| aws iam add-role-to-instance-profile --role-name ${ROLE_NAME} --instance-profile-name ${PROFILE_NAME} |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": "ec2.amazonaws.com" | |
| }, | |
| "Action": "sts:AssumeRole" | |
| } | |
| ] | |
| } |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "iam:*ServerCertificate*", | |
| "iam:*InstanceProfile*", | |
| "iam:PassRole", | |
| "iam:CreateRole", | |
| "iam:ListInstanceProfilesForRole", | |
| "iam:CreatePolicy", | |
| "iam:AttachRolePolicy" | |
| ], | |
| "Resource": "*" | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment