How do I assign an existing IAM role to an EC2 instance?
Last updated: 2020-09-18
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, wait for AWS Systems Manager Agent (SSM Agent) to detect the new IAM role, or restart SSM Agent. For more information, see Setting up AWS Systems Manager.