private static List allocateHosts()

in infrastructure/src/main/java/org/apache/geode/infrastructure/aws/LaunchCluster.java [148:174]


  private static List<String> allocateHosts(List<Tag> tags, int count, int timeout)
      throws InterruptedException {
    int gotHosts = 0;
    AllocateHostsResponse hosts;
    List<String> hostIds = new ArrayList<>();

    Instant end = Instant.now().plus(Duration.ofSeconds(timeout));
    do {
      hosts = ec2.allocateHosts(AllocateHostsRequest.builder()
          .availabilityZone(availabilityZone)
          .instanceType(AwsBenchmarkMetadata.instanceType().toString())
          .quantity(count - gotHosts)
          .tagSpecifications(TagSpecification.builder()
              .tags(tags)
              .resourceType(ResourceType.DEDICATED_HOST)
              .build())
          .build());
      hostIds.addAll(hosts.hostIds());
      gotHosts += hosts.hostIds().size();
      if (Instant.now().isAfter(end)) {
        throw new InterruptedException(
            count + " hosts were not allocated before timeout of " + timeout + " seconds.");
      }
    } while (gotHosts < count);

    return hostIds;
  }