【发布时间】:2014-05-27 01:36:32
【问题描述】:
我正在尝试使用 boto 启动一个实例。该实例需要在我的 VPC 内的特定子网上以及我的 VPC 内的特定安全组中启动。
以下代码在我的 VPC 中的正确子网上成功启动了一个实例:
conn.run_instances(
image_id=base_ami,
key_name=bakery_key,
subnet_id=bakery_subnet)
以下代码给了我以下错误:
reservation = conn.run_instances(
image_id=base_ami,
key_name=bakery_key,
security_groups=['TheNameOfMySecurityGroup'],
subnet_id=bakery_subnet)
这是我得到的错误。当我指定使用子网 ID 而不是子网的实际名称时,我得到了同样的错误:
Traceback (most recent call last):
File "./botobakery.py", line 24, in <module>
subnet_id=bakery_subnet)
File "/usr/lib/python2.6/site-packages/boto/ec2/connection.py", line 935, in run_instances
verb='POST')
File "/usr/lib/python2.6/site-packages/boto/connection.py", line 1177, in get_object
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidParameterCombination</Code><Message>The parameter groupName cannot be used with the parameter subnet</Message></Error></Errors> <RequestID>c8a6b824-4ab3-41d2-9633-9830c167d2d6</RequestID></Response>
如果有人知道如何将我的实例启动到我的特定子网和我的特定安全组中,我将非常感激和感激
【问题讨论】:
标签: python amazon-web-services amazon-ec2 boto