Source:
private AmazonWebServiceRequest createRequest(Pool pool, DelegateExecution execution, boolean spot) throws IOException { final String businessKey = execution.getProcessBusinessKey(); final String securityGroupName = SecurityGroups.formatNameFromBusinessKey(businessKey); final String keyPairName = KeyPairs.formatNameFromBusinessKey(businessKey); final String instanceType = pool.getHardware().getType(); final String imageId = getImageIdFromProcessVariablesOrQueryImageTable( execution, pool.getProvider(), instanceType); final String userData = Resources.toString(Resources.getResource(RunInstances.class, "/com/axemblr/provisionr/amazon/userdata.sh"), Charsets.UTF_8); if (spot) { Calendar validUntil = Calendar.getInstance(); validUntil.add(Calendar.MINUTE, 10); final String spotPrice = checkNotNull(pool.getProvider().getOption(ProviderOptions.SPOT_BID), "The bid for spot instances was not specified"); LaunchSpecification ls = new LaunchSpecification() .withInstanceType(instanceType) .withKeyName(keyPairName) .withImageId(imageId) .withSecurityGroups(Arrays.asList(new String[] { securityGroupName })) .withUserData(Base64.encodeBytes(userData.getBytes(Charsets.UTF_8))); return new RequestSpotInstancesRequest() .withSpotPrice(spotPrice) .withLaunchSpecification(ls) .withLaunchGroup(businessKey) .withInstanceCount(pool.getExpectedSize()) .withType(SpotInstanceType.OneTime) .withValidUntil(validUntil.getTime()); } else { return new RunInstancesRequest() .withClientToken(businessKey) .withSecurityGroups(securityGroupName) .withKeyName(keyPairName) .withInstanceType(instanceType) .withImageId(imageId) .withMinCount(pool.getMinSize()) .withMaxCount(pool.getExpectedSize()) .withUserData(Base64.encodeBytes(userData.getBytes(Charsets.UTF_8))); } }

Target:
private AmazonWebServiceRequest createRequest(Pool pool, DelegateExecution execution, boolean spot) throws IOException { final String businessKey = execution.getProcessBusinessKey(); final String securityGroupName = SecurityGroups.formatNameFromBusinessKey(businessKey); final String keyPairName = KeyPairs.formatNameFromBusinessKey(businessKey); final String instanceType = pool.getHardware().getType(); final String imageId = getImageIdFromProcessVariablesOrQueryImageTable( execution, pool.getProvider(), instanceType); final String userData = Resources.toString(Resources.getResource(RunInstances.class, "/com/axemblr/provisionr/amazon/userdata.sh"), Charsets.UTF_8); if (spot) { Calendar validUntil = Calendar.getInstance(); validUntil.add(Calendar.MINUTE, 10); final String spotPrice = checkNotNull(pool.getProvider().getOption(ProviderOptions.SPOT_BID), "The bid for spot instances was not specified"); LaunchSpecification ls = new LaunchSpecification() .withInstanceType(instanceType) .withKeyName(keyPairName) .withImageId(imageId) .withSecurityGroups(Lists.newArrayList(securityGroupName)) .withUserData(Base64.encodeBytes(userData.getBytes(Charsets.UTF_8))); return new RequestSpotInstancesRequest() .withSpotPrice(spotPrice) .withLaunchSpecification(ls) .withLaunchGroup(businessKey) .withInstanceCount(pool.getExpectedSize()) .withType(SpotInstanceType.OneTime) .withValidUntil(validUntil.getTime()); } else { return new RunInstancesRequest() .withClientToken(businessKey) .withSecurityGroups(securityGroupName) .withKeyName(keyPairName) .withInstanceType(instanceType) .withImageId(imageId) .withMinCount(pool.getMinSize()) .withMaxCount(pool.getExpectedSize()) .withUserData(Base64.encodeBytes(userData.getBytes(Charsets.UTF_8))); } }