How do I assign an existing IAM role to an EC2 instance?
Last updated: 2020-10-29
I have an AWS 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?
For detailed instructions on adding a role using the Amazon EC2 console or the AWS Command Line Interface (AWS CLI), see Attaching an IAM role to an instance.
Keep the following in mind:
- 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.
- If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.