Exemple #1
0
  private static void autoScale(OnDemandAWS bob2, double current) {
    Boolean isTerminated = bob2.getIsTerminated(false);

    if (bob2.getIsTerminated(false) && current >= upperT) {
      bob2.createInstance();
      System.out.println("Autoscale machine created.");
    } else if (!isTerminated && current < lowerT) {
      bob2.shutDownOnDemandAWS();
      System.out.println("Autoscale machine terminated.");
    }
  }
Exemple #2
0
  // Creates a machine and starts it up
  private static void createAndStartUpVM(OnDemandAWS machine, String bucketName) throws Exception {
    System.out.println("Creating machine...");
    machine.createInstance();

    // Sleep before starting up
    sleep(10);

    machine.startUpOnDemandAWS();
    System.out.println("Attach EBS " + machine.volumeId);
    machine.attachEBS();
    System.out.println("Attach S3");
    machine.attachS3(bucketName);
    System.out.println("Machine created.");
  }