private Set<RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String group, int count, Template template) { String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); String zone = getZoneFromLocationOrNull(template.getLocation()); RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturncustomize.execute(region, group, template); return createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
private Set<RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String group, int count, Template template) { String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); String zone = getZoneFromLocationOrNull(template.getLocation()); RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturncustomize.execute(region, group, template); return createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
private Set<RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String group, int count, Template template) { String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); String zone = getZoneFromLocationOrNull(template.getLocation()); RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturncustomize.execute(region, group, template); return createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
private Set<RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String group, int count, Template template) { String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); String zone = getZoneFromLocationOrNull(template.getLocation()); RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturncustomize.execute(region, group, template); return createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
private Set<RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String group, int count, Template template) { String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); String zone = getZoneFromLocationOrNull(template.getLocation()); RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturncustomize.execute(region, group, template); return createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
@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()) .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)); } return super.createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
@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()) .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)); } return super.createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }
@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()) .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)); } return super.createNodesInRegionAndZone(region, zone, group, count, template, instanceOptions); }