Created
February 20, 2017 14:40
-
-
Save geek182/f8d63102a5aa9a8c68b3cb6ad51caa3d to your computer and use it in GitHub Desktop.
Change IAM ROLE AWS
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
#Get id IAM Profile | |
# --profile name_of_profile, if needed | |
aws ec2 describe-iam-instance-profile-associations --filters "Name=instance-id,Values=i-00000000000000" | |
Result: | |
{ | |
"IamInstanceProfileAssociations": [ | |
{ | |
"InstanceId": "i-000000000000000", | |
"State": "associated", | |
"AssociationId": "iip-assoc-000000000000", | |
"IamInstanceProfile": { | |
"Id": "AAAAAAAAAAAAAAAAA", | |
"Arn": "arn:aws:iam::00000000:instance-profile/name_of_role" | |
} | |
} | |
] | |
} | |
#Change iam role | |
aws ec2 replace-iam-instance-profile-association --association-id iip-assoc-00000000000000 --iam-instance-profile Name="name_of_role" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment