I need to launch a instance from a AMI .. moreover.. i need to launch the new instance with same attributes as the original instance from which the AMI was created.. i.e ,, same VPC id , same key_name, same _region etc etc
my code accepts is:
reservations = conn.get_all_instances(instance_ids=[sys.argv[1]])
instances = [i for r in reservations for i in r.instances]
for i in instances:
key_name = i.key_name
# security_group = "sg-f05ee295" #i.groups
instance_type = i.instance_type
# print security_group[0]
# subnet_name = i.subnet_id
reserve = conn.run_instances(image_id=ami_id,key_name=key_name,instance_type=instance_type,security_group_ids =['sg-f05ee295'])
print "new replica system id is " + reserve.instances[0].id
This is not working, since it says::
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidParameterCombination</Code><Message>VPC security groups may not be used for a non-VPC launch</Message></Error></Errors><RequestID>57c29a87-8f6c-462d-a16b-7a4888dd5341</RequestID></Response>
HELP ME OUT!!!!!!!
Aucun commentaire:
Enregistrer un commentaire