Something like this should work:
>>> import boto >>> autoscale = boto.connect_autoscale() >>> ec2 = boto.connect_ec2() >>> group = autoscale.get_all_groups(['mygroupname'])[0] >>> instance_ids = [i.instance_id for i in group.instances] >>> reservations = ec2.get_all_instances(instance_ids) >>> instances = [i for r in reservations for i in r.instances]
The reason we need to collect the instance ID and then call EC2 is because AutoScale only stores a small subset of the instance information. This will cause the variable instances to point to a list of instance objects for each instance in the autosave group "mygroupname".
garnaat
source share