'Launches cluster using spot instances for all worker nodes. This method
makes a single spot request for each node in the cluster since spot
instances *always* have an ami_launch_index of 0. This is needed in
order to correctly assign aliases to nodes.'

def _create_spot_cluster(self):

    master_alias = self._make_alias(master=True)
    (mtype, mimage) = self._get_type_and_image_id(master_alias)
    log.info(('Launching    master    node    (ami:    %s,    type:    %s)...' % (mimage, mtype)))
    force_flat = (not self.force_spot_master)
    master_response = self.create_node(master_alias, image_id=mimage, instance_type=mtype, force_flat=force_flat)
    (insts, spot_reqs) = ([], [])
    zone = None
    if ((not force_flat) and self.spot_bid):
        launch_spec = master_response.launch_specification
        zone = launch_spec.placement
        spot_reqs.append(master_response)
    else:
        zone = master_response.instances[0].placement
        insts.extend(master_response.instances)
    for id in range(1, self.cluster_size):
        alias = self._make_alias(id)
        (ntype, nimage) = self._get_type_and_image_id(alias)
        log.info(('Launching    %s    (ami:    %s,    type:    %s)' % (alias, nimage, ntype)))
        spot_req = self.create_node(alias, image_id=nimage, instance_type=ntype, zone=zone)
        spot_reqs.append(spot_req)
    self.ec2.wait_for_propagation(instances=insts, spot_requests=spot_reqs)
