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

前端 未结 5 1964
时光说笑
时光说笑 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:19

    The Roles must be assigned when an instance is first launched.

    It is not possible to assign the Role after the launched.

    I would recommend launching a new instance via the Launch More Like This console command. Please note this will create a new boot disk based on the same AMI, so any data you've saved will not be copied across. If you wish to save the data, you will need to create an AMI from the instance and launch the new instance from that AMI.

    Update Feb 2017: It is now possible to add an IAM Role to an existing instance. This can be done via the AWS Command-Line Interface (CLI). Use the replace-iam-instance-profile-association command.

提交回复
热议问题