【发布时间】:2019-03-13 04:37:19
【问题描述】:
当我在vpc中使用boto(python sdk for aws)给我的实例分配弹性ip时,报如下错误:
<Response>
<Errors>
<Error>
<Code>InvalidParameterCombination</Code>
<Message>You must specify an allocation id when mapping an address to a network interface</Message>
</Error>
</Errors>
<RequestID>d0f95756-c36f-417a-9fa9-1158c4aa19e9</RequestID>
</Response>
但是我在 ec2-medata 中没有发现任何关于分配 id 的信息。
有人知道我如何从 API 获取分配 id 吗?
我已经在控制台看到了:
try:
conn = boto.ec2.connect_to_region(zone, aws_access_key_id='a-id', aws_secret_access_key='s-id',debug=2)
conn.associate_address(allow_reassociation=True, public_ip=kw['ip'], network_interface_id=nid, dry_run=True)
【问题讨论】:
-
尝试:conn = boto.ec2.connect_to_region(zone, aws_access_key_id='aid', aws_secret_access_key='sid',debug=2) if kw.has_key('type') and kw['type '] == 'elastic': conn.associate_address(allow_reassociation=True, public_ip=kw['ip'], network_interface_id=nid, dry_run=True) else: conn.assign_private_ip_addresses(allow_reassignment=True, network_interface_id=nid, private_ip_addresses=kw ['ip'])
-
这不可读 - 请将其添加到您的问题中,格式化等。
标签: python amazon-ec2 boto