python boto3将IAM角色附加/替换到ec2

2024-05-19 10:22:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法通过boto3将IAM角色附加/替换到EC2实例。
位于cloudhackers的文档提供了一个方法来运行带有IAM角色的映像,但不提供附加。在

肉搏有可能吗?否则,我需要手工操作。在


Tags: 实例方法文档角色boto3ec2iam手工操作
1条回答
网友
1楼 · 发布于 2024-05-19 10:22:41

阅读文档here

关联实例配置文件(**kwargs)
将IAM实例配置文件与正在运行或已停止的实例相关联。不能将多个IAM实例配置文件与一个实例关联。在

请求语法

response = client.associate_iam_instance_profile(
    IamInstanceProfile={
        'Arn': 'string',
        'Name': 'string'
    },
    InstanceId='string'
)

响应语法

^{pr2}$

顺便说一下,你提供的链接上面有一个横幅,上面写着

Note You are viewing the documentation for an older version of boto (boto2). Boto3, the next version of Boto, is now stable and recommended for general use.

相关问题 更多 >

    热门问题