@Override
  public void deploy(File appWarFile) {

    log.info("Finding S3 bucket to upload WAR");

    String bucketName = elasticBeanstalk.createStorageLocation().getS3Bucket();

    String s3key = uniqueTempWarFileName(appWarFile);
    uploadToS3(appWarFile, bucketName, s3key);

    String versionLabel = getVersionLabel(appWarFile);

    log.info("Create application version with uploaded application");

    CreateApplicationVersionRequest cavr = new CreateApplicationVersionRequest();
    cavr.setApplicationName(applicationName);
    cavr.setVersionLabel(versionLabel);
    cavr.setDescription(getDescription());
    cavr.setAutoCreateApplication(true);
    cavr.setSourceBundle(new S3Location(bucketName, s3key));

    CreateApplicationVersionResult result;
    result = elasticBeanstalk.createApplicationVersion(cavr);

    log.info("Created application version {}", result);

    log.info("Updating environment with uploaded application version");

    UpdateEnvironmentRequest uer;
    uer = new UpdateEnvironmentRequest();

    uer.setEnvironmentName(environmentName);
    uer.setVersionLabel(versionLabel);

    UpdateEnvironmentResult result2;
    result2 = elasticBeanstalk.updateEnvironment(uer);

    log.info("Updated environment {}", result2);
  }
  protected Object executeInternal() throws MojoExecutionException, MojoFailureException {
    UpdateEnvironmentRequest req = new UpdateEnvironmentRequest();

    req.setEnvironmentId(curEnv.getEnvironmentId());
    req.setEnvironmentName(curEnv.getEnvironmentName());

    if (WhatToSet.versionLabel.equals(whatToSet)) {
      req.setVersionLabel(versionLabel);
    } else if (WhatToSet.description.equals(whatToSet)) {
      req.setDescription(environmentDescription);
    } else if (WhatToSet.optionSettings.equals(whatToSet)) {
      req.setOptionSettings(getOptionSettings(optionSettings));
    } else if (WhatToSet.templateName.equals(whatToSet)) {
      req.setTemplateName(lookupTemplateName(applicationName, templateName));
    } else if (WhatToSet.optionsToRemove.equals(whatToSet)) {
      req.setOptionsToRemove(getOptionsToRemove(optionsToRemove));
    }

    return getService().updateEnvironment(req);
  }