def launch_instances(self,
                         count,
                         ssh_key_name,
                         user_data,
                         spot_request_bid_price=None,
                         callback=None):
        assert self.instance_type is not None
        assert self.connected

        network_interfaces = self.create_network_interfaces()
        classic_security_groups = None if self.vpc_id else [self.get_security_group_name()]

        if self.instance_type[:2] in ("c3", "m3"):
            image_id = self.ubuntu_images_paravirtual_ssd[self.region]
        else:
            image_id = self.ubuntu_images_hvm_ssd[self.region]

        #ensure that we allocate enough space to install everything
        dev_sda1 = boto.ec2.blockdevicemapping.BlockDeviceType()
        dev_sda1.size = 15
        bdm = boto.ec2.blockdevicemapping.BlockDeviceMapping()
        bdm['/dev/sda1'] = dev_sda1

        request_args = {
            'image_id': image_id,
            'instance_type': self.instance_type,
            'key_name': ssh_key_name,
            'user_data': user_data,
            'security_groups': classic_security_groups,
            'network_interfaces': network_interfaces,
            'block_device_map': bdm
            }
        if spot_request_bid_price:
            ts = timestamp()
            spot_requests = self.ec2.request_spot_instances(
                price=spot_request_bid_price,
                count=count,
                availability_zone_group=ts,
                launch_group=ts,
                **request_args)
            fulfilled, unfulfilled = self.wait_for_spot_instance_requests(spot_requests,
                                                                          callback=callback)
            assert len(fulfilled) == count or len(unfulfilled) == count
            if len(fulfilled) == 0:
                return []
            return self.ec2.get_only_instances(instance_ids=[r.instance_id for r in fulfilled])
        else:
            reservation = self.ec2.run_instances(
                min_count=count,
                max_count=count,
                **request_args
                )
            return reservation.instances
dataset/ETHPy150Open ufora/ufora/packages/python/pyfora/aws/Launcher.py/Launcher.launch_instances/original