instance = AmazonEC2Util.startInstances(ec2client, amazonSecurityContext.getAmiId(),
amazonSecurityContext.getInstanceType(), jobExecutionContext, KEY_PAIR_NAME).get(0);
else {
// already running instance
DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest();
DescribeInstancesResult describeInstancesResult =
ec2client.describeInstances(describeInstancesRequest.
withInstanceIds(amazonSecurityContext.getInstanceId()));
if (describeInstancesResult.getReservations().size() == 0 ||
describeInstancesResult.getReservations().get(0).getInstances().size() == 0) {
throw new GFacProviderException("Instance not found:" + amazonSecurityContext.getInstanceId());