All about Cloud, mostly about Amazon Web Services (AWS)

Adding and Updating the IAM Role for an EC2 Instance

 2017-09-03 /  328 words /  2 minutes

It has been possible to assign an AWS Identity and Access Management (IAM) Role to an Amazon Elastic Compute Cloud (EC2) Instance at launch time for a while now. An IAM Role attached to an EC2 Instance was called an Instance Profile. It was simple to setup from the AWS Management Console, but required a couple of steps from the AWS Command Line Interface (CLI) or AWS CloudFormation. It was impossible to change the instance profile though. Updating it meant deleting and then re-creating the EC2 instance. I recently noticed in the AWS Console that the term “Instance Profile” was gone, but new IAM Role functionality was available.

Adding and Updating the IAM Role for an EC2 Instance

The new functionality allows for:

  • an IAM Role to be attached to an EC2 Instance which does not have an IAM Role.
  • an IAM Role to be replaced on an EC2 Instance which already has an IAM Role.
  • There is no need to restart the EC2 Instance in order to perform these tasks.

After a little searching, I found this functionality had been available from the CLI since 9th February 2017, and was announced here.

To make updates from the AWS Console, first login and open EC2 then the Instances page. Next, select the EC2 instance and go to the Actions pop-up, and select Instance Settings.

The EC2 Actions Menu

Clicking “Attach/Replace IAM Role” will open a new page, shown below. The page displays the Instance ID and Instance Name which is useful to be absolutely sure that the right EC2 Instance is being updated. The page also allows for an existing IAM Role to be used by selecting from the drop down box, or a link is provided which allow a new IAM Role to be created.

The Attach/Replace IAM Role Screen

From this page, the user can attach an IAM Role to an EC2 Instance which does not have an IAM Role, or switch the IAM Role of an EC2 Instance which already has an IAM Role.


Tags:  AWS  Amazon Identity and Access Management (IAM)  AWS Console  AWS Command Line Interface (CLI)  Amazon CloudFormation  AWS Elastic Cloud Compute (EC2)  Instance Profile  Profile  IAM  Role  IAM Role
Categories:  AWS  Amazon Identity and Access Management (IAM)  AWS Console  AWS Command Line Interface (CLI)  Amazon CloudFormation  AWS Elastic Cloud Compute (EC2)

See Also

 Top Ten Tags

AWS (43)   Kinesis (9)   Streams (8)   AWS Console (5)   Go (5)   Analytics (4)   Data (4)   database (4)   Amazon DynamoDB (3)   Amazon Elastic Compute Cloud (EC2) (3)  


All Tags (173)

Disclaimer

All data and information provided on this site is for informational purposes only. cloudninja.cloud makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. My opinions may change over time.