lundi 28 septembre 2015

How to store the details of a Amazon EC2 instance in varibles and then use the variables to launch more

 import boto.ec2
 import time
 import sys
 conn = boto.ec2.connect_to_region("ap-southeast-1")

 reservations=conn.get_all_instances(sys.argv[1])
 instances = [i for r in reservations for i in r.instances]
 for i in instances:
     print(i.__dict__)

The above code is able to fetch details of the instance i provide as argument, i need to launch a new instance from the ami of this instance, how do i store the details in a variable and then use it to launch a new instance in same VPC??




Aucun commentaire:

Enregistrer un commentaire