将角色与正在运行的AWS实例相关联 [英] Associate a Role to a running AWS instance

查看:117
本文介绍了将角色与正在运行的AWS实例相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了运行AWS监视脚本( http://docs.aws .amazon.com / AmazonCloudWatch / latest / DeveloperGuide / mon-scripts-perl.html )在我的ec2现有实例中,我需要一个与该实例相关联的IAM角色。

In order to run AWS monitoring scripts (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts-perl.html) on one of my ec2 existing instance, I need a IAM role associated to the instance.

我发现了很多文档来启动具有角色的实例...但是没有任何将角色链接到现有实例的东西。

I found a lot of documentation to launch an instance with a role... But nothing to link a role to an existing instance.

是吗

如果没有,我该怎么办?

If not, what can I do? Launch a new instance with a role and transfert the volumes to it?

推荐答案

有一个新方法可用 associate-iam-instance-profile 将IAM实例配置文件与正在运行或已停止的实例相关联。

There is a new method available associate-iam-instance-profile to Associates an IAM instance profile with a running or stopped instance.

示例:

aws ec2 associate-iam-instance-profile --instance-id YourInstanceId --iam-instance-profile Name=YourNewRole-Instance-Profile

Doco

这篇关于将角色与正在运行的AWS实例相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆