protected String searchIndexForDownloadUrl(String searchQuery, List<ContentXml> index) {
    if ("latest".equalsIgnoreCase(searchQuery)) {
      return index.stream()
        .filter(c -> c.key.endsWith(".osm.pbf"))
        .map(c -> bucketIndexUrl + c.key)
        .max(Comparator.naturalOrder())
        .orElseThrow(() -> new IllegalArgumentException("Unable to find latest AWS osm download URL"));
    } else {
      List<String> results = index.stream()
        .filter(c -> c.key.endsWith("/planet-" + searchQuery + ".osm.pbf"))
        .map(c -> bucketIndexUrl + c.key)
        .toList();
      if (results.isEmpty()) {
        throw new IllegalArgumentException("Unable to find AWS osm download URL for " + searchQuery);
      } else if (results.size() > 1) {
        throw new IllegalArgumentException("Found multiple AWS osm download URLs for " + searchQuery + ": " + results);
      }
      return results.getFirst();
    }
  }
Fetches the S3 bucket index and searches for a {@code .osm.pbf} resource to download where snapshot date matches
{@code searchQuery}, or the latest snapshot if {@code searchQuery == "latest"}.
<p>
The index is only fetched once and cached after that.

@param searchQuery the snapshot to search for
@param config      planetiler config with user-agent and timeout to use when downloading
@return the URL of a {@code .osm.pbf} file with name or snapshot ID matching {@code searchQuery}
@throws IllegalArgumentException if no matches, or more than one match is found.
planetiler-core/src/main/java/com/onthegomap/planetiler/util/AwsOsm.java