Package com.amazonaws.services.ec2.model

Examples of com.amazonaws.services.ec2.model.RunInstancesRequest


                .withInstanceCount(pool.getExpectedSize())
                .withType(SpotInstanceType.OneTime)
                .withValidUntil(validUntil.getTime());

        } else {
            return new RunInstancesRequest()
                .withClientToken(businessKey)
                .withSecurityGroups(securityGroupName)
                .withKeyName(keyPairName)
                .withInstanceType(instanceType)
                .withImageId(imageId)
View Full Code Here


  @Override
  public Instance call() {
    Placement placement = new Placement()
        .withAvailabilityZone(this.availabilityZone);
    RunInstancesRequest request = new RunInstancesRequest().withMinCount(1)
        .withMaxCount(1).withImageId(this.imageId)
        .withInstanceType(this.instanceType)
        .withUserData(AmazonApiUtils.base64Encode(this.bootScript))
        .withSecurityGroupIds(this.securityGroups)
        .withKeyName(this.keyPair).withPlacement(placement);
View Full Code Here

        }

        // If a RunInstancesRequest doesn't specify a ClientToken, fill one in, otherwise
        // retries could result in unwanted instances being launched in the customer's account.
        else if (originalRequest instanceof RunInstancesRequest) {
            RunInstancesRequest runInstancesRequest = (RunInstancesRequest)originalRequest;
            if (runInstancesRequest.getClientToken() == null) {
                request.getParameters().put("ClientToken", UUID.randomUUID().toString());
            }
        }
    }
View Full Code Here

        }

        // If a RunInstancesRequest doesn't specify a ClientToken, fill one in, otherwise
        // retries could result in unwanted instances being launched in the customer's account.
        else if (originalRequest instanceof RunInstancesRequest) {
            RunInstancesRequest runInstancesRequest = (RunInstancesRequest)originalRequest;
            if (runInstancesRequest.getClientToken() == null) {
                request.getParameters().put("ClientToken", UUID.randomUUID().toString());
            }
        }
    }
View Full Code Here

        }

        // If a RunInstancesRequest doesn't specify a ClientToken, fill one in, otherwise
        // retries could result in unwanted instances being launched in the customer's account.
        else if (originalRequest instanceof RunInstancesRequest) {
            RunInstancesRequest runInstancesRequest = (RunInstancesRequest)originalRequest;
            if (runInstancesRequest.getClientToken() == null) {
                request.getParameters().put("ClientToken", UUID.randomUUID().toString());
            }
        }

        // If a ModifyReservedInstancesRequest doesn't specify a ClientToken, fill one in, otherwise
View Full Code Here

    }

    @Override
    public void execute(AmazonEC2 client, Pool pool, DelegateExecution execution) throws IOException {

        final RunInstancesRequest request = createOnDemandInstancesRequest(pool, execution);
        // TODO allow for more options (e.g. monitoring & termination protection etc.)

        LOG.info(">> Sending RunInstances request: {}", request);
        RunInstancesResult result = client.runInstances(request);
        LOG.info("<< Got RunInstances result: {}", result);
View Full Code Here

                .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)
View Full Code Here

    List<Instance> resultList = new ArrayList<Instance>();

    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
    request.setInstanceType(type);

    RunInstancesResult result = getEC2Client().runInstances(request);
    resultList.addAll(result.getReservation().getInstances());
    return resultList;
  }
View Full Code Here

    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
    request.setInstanceType(type);
    request.setKeyName(keyname);

    RunInstancesResult result = getEC2Client().runInstances(request);
    resultList.addAll(result.getReservation().getInstances());
    return resultList;
  }
View Full Code Here

    // start only 1 instance
    RunInstancesRequest request = new RunInstancesRequest(AMI_ID, 1, 1);
    request.setKeyName(KEY_PAIR_NAME);
    request.setInstanceType(INS_TYPE);

    RunInstancesResult result = ec2.runInstances(request);

    List<Instance> instances = result.getReservation().getInstances();

    while (!allInstancesStateEqual(instances, InstanceStateName.Running)) {

      // instance status should not be Terminated
      if (anyInstancesStateEqual(instances, InstanceStateName.Terminated)) {
View Full Code Here

TOP

Related Classes of com.amazonaws.services.ec2.model.RunInstancesRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.