def get_instance_info(client):
    """ Get some info on all the instances with Role=trainingvm
    """
    # Find all VMs that have a Role of trainingvm
    resp = client.describe_instances(Filters=[dict(Name='tag:Role', Values=['trainingvm'])])

    # A bad query raises an exception, so we shouldn't need this
    assert resp['ResponseMetadata']['HTTPStatusCode'] == 200

    # Now dig out the instances
    instances = [ i for r in resp['Reservations'] for i in r['Instances'] ]

    # Filter out anything in state 'terminated'
    instances = [ i for i in instances if i['State']['Name'] != 'terminated' ]

    def l_to_d(td):
        """Transform a list of Key/Value dicts to a single dict
        """
        return { i['Key']: i['Value'] for i in td }

    # Get the pertinent info for the instances
    return [ dict( instanceId = i['InstanceId'],
                   Name = l_to_d(i['Tags'])['Name'],
                   VM = l_to_d(i['Tags'])['Name'].split('-')[-1],
                   PrivateName = i['PrivateDnsName'],
                   PublicName = i.get('PublicDnsName'),
                   State = i['State']['Name'] )
             for i in instances ]