def ec2_instances():
    "Use the EC2 API to get a list of all machines"
    region = boto.ec2.get_region(REGION)
    reservations = region.connect().get_all_instances()
    instances = []
    for reservation in reservations:
        instances += reservation.instances
    return instances
Use the EC2 API to get a list of all machines