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?

Resolution

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: