code: public String getAmazonRegion(String endpoint) {
          if (isBlank(endpoint)) {
              return DEFAULT_AMAZON_REGION;
          }
          final Pattern pattern = Pattern.compile("(https://)?(.+)?\\.(.+)\\."+AMAZON_HOSTNAME+"(\\.cn)?");
          final Matcher matcher = pattern.matcher(endpoint);
          if (matcher.find()) {
              return matcher.group(3);
          }
          return DEFAULT_AMAZON_REGION;
      }
docs: todo does not recognize properly us-east-2.quicksight.amazonaws.com, us-west-1.queue.amazonaws.com types of hostname