def get_all_instances(): all_ec2 = {} for r in get_ec2_instances(): instance = r['Instances'][0] instance_id = instance['InstanceId'] instance_securitygroups = grab_from( get_instance_securitygroup_ids(instance), get_all_securitygroups()) instance["SecurityGroups"] = instance_securitygroups instance = expand_tags(instance) all_ec2[instance_id] = instance return all_ec2
def get_instances_in(subnet_id): instance_filter = "--filters Name=subnet-id,Values=%s" % subnet_id all_ec2 = {} for r in get_ec2_instances(instance_filter): instance = r['Instances'][0] instance_id = instance['InstanceId'] instance_securitygroups = grab_from( get_instance_securitygroup_ids(instance), get_all_securitygroups()) instance["SecurityGroups"] = instance_securitygroups instance = expand_tags(instance) all_ec2[instance_id] = instance return all_ec2
def get_all_instances(): all_ec2 = {} for r in get_ec2_instances(): instance = r['Instances'][0] instance_id = instance['InstanceId'] instance_securitygroups = grab_from( get_instance_securitygroup_ids(instance), get_all_securitygroups() ) instance["SecurityGroups"] = instance_securitygroups instance = expand_tags(instance) all_ec2[instance_id] = instance return all_ec2
def get_instances_in(subnet_id): instance_filter = "--filters Name=subnet-id,Values=%s" % subnet_id all_ec2 = {} for r in get_ec2_instances(instance_filter): instance = r['Instances'][0] instance_id = instance['InstanceId'] instance_securitygroups = grab_from( get_instance_securitygroup_ids(instance), get_all_securitygroups() ) instance["SecurityGroups"] = instance_securitygroups instance = expand_tags(instance) all_ec2[instance_id] = instance return all_ec2