【发布时间】:2021-09-24 08:52:48
【问题描述】:
我正在尝试使用 boto3 将实例配置文件附加到 EC2 实例。我正在关注 boto3 文档https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.associate_iam_instance_profile
但它失败并出现以下错误:
AttributeError: 'EC2' 对象没有属性 'associate_iam_instance_profile'
你能帮我解决这个问题吗?
这是代码sn-p
import boto3
ec2=boto3.client('ec2',region_name='ca-central-1')
response = ec2.associate_iam_instance_profile(IamInstanceProfile={'Arn': 'arn:aws:iam::1234567890:instance-profile/instanceprofilename','Name': 'instanceprofilename'},InstanceId='i-1234567890')
我们将不胜感激。
boto3==1.4.3
Python 3.8.6
谢谢
【问题讨论】:
-
您的 version of boto3 已过期近 5 年。
标签: python amazon-web-services amazon-ec2 boto3 amazon-iam