IAM Role does not show in role list of EC2, even though I have the trust relationship set up correctly

Viewed 657

I have the following demo role created for AWS:

Demo Role Summary

with the following trust relationship:

Demo Role Trust Relationships

Now, I am trying to modify the role of an EC2 instance to be DemoRoleForEC2, but the role is not appearing in the dropdown list:

Modify IAM Role Page

According to this answer here: IAM Role not showing in aws console in Modify IAM role page , it should be working fine as the Trust Relationships are ok, but it is not.

Other things I tried was stopping and restarting the EC2 Instance, and trying to create the role from the "Modify Role for IAM" page, but none worked. Any idea what the issue might be?

3 Answers

Just to update this answer, apparently, what is happening is that when creating a role, its instance profile is not being automatically created (I haven't figured out the reason yet). What I did was running these two commands on CLI:

aws iam create-instance-profile --instance-profile-name MyRoleInstanceProfile
aws iam add-role-to-instance-profile --role-name MyRole --instance-profile-name MyRoleInstanceProfile

And then the role will appear in the list in the "Modify Role for IAM" page.

One thing to check is the browser you are using to do this task and any browser extensions you may have installed.

I hit this issue where I was creating an EC2 role via the AWS console but it was not creating the instance profile.

I found the issue to be because I was using chrome and with the ClearURLs extension. I disabled this extension and when I then tried to create the role via the console, then the instance profile was also being created.

In my case I was creating an instance profile and adding a role with the CLI. Then, the instance profile was not showing up on EMR but it was appearing on EC2. After several attempts I tried naming the instance profile and the role with the same name (and no special characters), and then it worked.

Related