public static String[] parseS3path(String str) throws IllegalArgumentException {
        String[] ret = {"",""};
        String regex = "s3://([^/]+)/(.+)";
        Pattern pattern = Pattern.compile(regex);

        Matcher m = pattern.matcher(str);

        if (m.find()){
            ret[0] = m.group(1);
            ret[1] = m.group(2);
            if (!ret[1].endsWith("/")) {
                ret[1] += "/";
            }
        } else {
            throw new IllegalArgumentException("bad URL:" + str);
        }

        return ret;

    }