[英]aws modify reserved instances
AWS python boto3遇到问题,请致电ec2.meta.client.modify_reserved_instances()
。
我收到以下错误:
botocore.exceptions.ParamValidationError:参数验证失败:TargetConfigurations [0]中的未知参数:“ Scope”,必须为以下之一:AvailabilityZone,Platform,InstanceCount,InstanceType
这是我的功能:
def modify_reserved_instance(self, region, iid, icount, itype):
ec2 = boto3.resource(
'ec2', region_name=region[:-1], api_version='2016-04-01')
response = ec2.meta.client.modify_reserved_instances(
ClientToken='string',
ReservedInstancesIds=[
iid,
],
TargetConfigurations=[
{
'AvailabilityZone': region,
'Platform': 'Linux/UNIX (Amazon VPC)',
'InstanceCount': icount,
'InstanceType': itype,
'Scope': 'Availability Zone'
},
]
)
print (response)
return response
我已经尝试将Scope用作AvailabilityZone
和Availability Zone
。
更新的botocore: sudo pip install botocore --upgrade
从github安装了boto3 / botocore: https://github.com/boto/boto3
: https://github.com/boto/boto3
有没有其他人使用过boto3.resource('ec2')
对象中的方法?
bot3文档modify_reserved_instance()
参数如下:
us-west-2c
standard
或convertible
您的错误消息说boto3无法识别Scope
参数 。
并不是说Scope参数应该设置为“ AvailabilityZone,Platform,InstanceCount,InstanceType”,它们只是期望的参数列表(而Scope不是其中之一)。
可转换的预留实例于2016年9月可用 。 您的boto3
本地副本boto3
已过期。
我建议您将boto3
的版本更新为知道Scope参数的版本:
sudo pip install boto3 --upgrade
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.