I created an IAM role, but the role doesn't appear in the dropdown list when I launch an instance. What do I do?
3 minute read
I created a new AWS Identity and Access Management (IAM) role, but I can't find the role in the dropdown list when launching an instance.
The dropdown list includes instance profiles and not IAM roles, but you can add an IAM role to an instance profile. You must choose the instance profile that has the required IAM role added to it.
Follow these steps to create a new IAM role linked to an instance profile. Then, choose the instance profile from the dropdown list when you launch your instance. Create a new IAM role linked to an instance profile using either the IAM console or the AWS Command Line Interface (AWS CLI).
$ aws iam create-instance-profile --instance-profile-name Webserver
4. Add an IAM role to the instance profile by running the following command:
$ aws iam add-role-to-instance-profile --role-name Test-Role --instance-profile-name Webserver
For an existing IAM role for EC2, you must add the EC2 service principal into its existing trust policy. For more information, see
Specifying a principal.
Note: If the IAM roles and instance profiles have different names, then make sure that you select the correct instance profile. The correct instance profile has the required IAM role added to it when launching an EC2 instance. The IAM role won't be listed in the dropdown list.