how to add IAM role to an existing instance in aws?

前端 未结 5 1881
时光说笑
时光说笑 2021-02-12 22:44

I would like to add an IAM Role to an existing EC2 instance in AWS. I tried using AWS CLI. However, I could not find a way to do that.

5条回答
  •  心在旅途
    2021-02-12 23:31

    As of AWS CLI v1.11.46, which was released just yesterday (see the CHANGELOG file on GitHub), you can now attach an IAM role to an existing EC2 instance that was originally launched without an IAM role using the associate-iam-instance-profile command.

    You can also replace the currently attached IAM role for a running instance using replace-iam-instance-profile-association.

    For more details, see the following article on AWS Security Blog:

    Attach an AWS IAM Role to an Existing Amazon EC2 Instance by Using the AWS CLI.

    UPDATE

    As of Feb 22, 2017, you can attach/replace an IAM role to an existing EC2 instance from the EC2 console as well. See this blog post for more details.

提交回复
热议问题