Skip to content

Instantly share code, notes, and snippets.

@geek182
Created February 20, 2017 14:40
Show Gist options
  • Save geek182/f8d63102a5aa9a8c68b3cb6ad51caa3d to your computer and use it in GitHub Desktop.
Save geek182/f8d63102a5aa9a8c68b3cb6ad51caa3d to your computer and use it in GitHub Desktop.
Change IAM ROLE AWS
#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