@Override
protected Set<RunningInstance> createNodesInRegionAndZone(String region, String zone, String group,
int count, Template template, RunInstancesOptions instanceOptions) {
Float spotPrice = getSpotPriceOrNull(template.getOptions());
if (spotPrice != null) {
AWSEC2TemplateOptions awsOptions = AWSEC2TemplateOptions.class.cast(template.getOptions());
LaunchSpecification spec = AWSRunInstancesOptions.class.cast(instanceOptions).getLaunchSpecificationBuilder()
.imageId(template.getImage().getProviderId()).availabilityZone(zone).subnetId(awsOptions.getSubnetId())
.publicIpAddressAssociated(awsOptions.isPublicIpAddressAssociated())
.iamInstanceProfileArn(awsOptions.getIAMInstanceProfileArn())
.iamInstanceProfileName(awsOptions.getIAMInstanceProfileName()).build();
RequestSpotInstancesOptions options = awsOptions.getSpotOptions();
if (logger.isDebugEnabled())
logger.debug(">> requesting %d spot instances region(%s) price(%f) spec(%s) options(%s)", count, region,
spotPrice, spec, options);
return ImmutableSet.<RunningInstance> copyOf(transform(client.getSpotInstanceApi().get()
.requestSpotInstancesInRegion(region, spotPrice, count, spec, options), spotConverter));