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?
- From the Amazon EC2 console, choose Instances from the navigation pane.
- Select the instance that you want to attach the IAM role to.
For Actions, choose Instance Settings, Attach/Replace IAM role.
- For IAM role, choose your IAM role, and then choose Apply.
- 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.