【发布时间】:2016-10-30 16:07:06
【问题描述】:
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
我已经尝试使用 AvailabilityZone 和 Availability Zone 的范围。
更新了 botocore:
sudo pip install botocore --upgrade从 github 安装 boto3/botocore:
https://github.com/boto/boto3
有没有其他人使用过boto3.resource('ec2')对象的方法?
【问题讨论】:
-
虽然与错误消息没有明显关系(这表明字符串中的空格肯定需要删除),但这似乎是错误的:
{ 'AvailabilityZone': region, ... }A region is not the same thing as a availability zone .例如,us-west-2是区域,us-west-2c是区域内的可用区。
标签: python amazon-web-services boto3