List<LaunchConfiguration> lcs = new LinkedList<LaunchConfiguration>();
AmazonAutoScalingClient asgClient = asgClient();
DescribeLaunchConfigurationsRequest request = new DescribeLaunchConfigurationsRequest()
.withLaunchConfigurationNames(names);
DescribeLaunchConfigurationsResult result = asgClient.describeLaunchConfigurations(request);
lcs.addAll(result.getLaunchConfigurations());
while (result.getNextToken() != null) {
request.setNextToken(result.getNextToken());
result = asgClient.describeLaunchConfigurations(request);
lcs.addAll(result.getLaunchConfigurations());
}
LOGGER.info(String.format("Got %d launch configurations in region %s.", lcs.size(), region));
return lcs;
}