How do I assign an existing IAM role to an EC2 instance?

Last updated: 2020-01-17

I have an Identity and Access Management (IAM) role that I want to assign to an Amazon Elastic Compute Cloud (Amazon EC2) instance. How can I do this? 

Resolution

  1. From the Amazon EC2 console, choose Instances from the navigation pane.
  2. Select the instance that you want to attach the IAM role to.
    For Actions, choose Instance Settings, Attach/Replace IAM role.
  3. For IAM role, choose your IAM role, and then choose Apply.
  4. Choose Close.

The IAM role is now assigned to your EC2 instance.

Note: If you use AWS Systems Manager, you might need to restart AWS Systems Manager Agent (SSM Agent), or wait for SSM Agent to detect the new IAM role. For more information, see Setting Up AWS Systems Manager.