@Override
    public InputStream fetch(String fetchKey, long startRange, long endRange, Metadata metadata, ParseContext parseContext)
            throws TikaException, IOException {
        String theFetchKey = StringUtils.isBlank(prefix) ? fetchKey : prefix + fetchKey;

        if (LOGGER.isDebugEnabled()) {
            if (startRange > -1) {
                LOGGER.debug("about to fetch fetchkey={} (start={} end={}) from bucket ({})",
                        theFetchKey, startRange, endRange, bucket);
            } else {
                LOGGER.debug("about to fetch fetchkey={} from bucket ({})",
                        theFetchKey, bucket);
            }
        }
        int tries = 0;
        IOException ex = null;
        do {
            try {
                long start = System.currentTimeMillis();
                InputStream is = _fetch(theFetchKey, metadata, startRange, endRange);
                long elapsed = System.currentTimeMillis() - start;
                LOGGER.debug("total to fetch {}", elapsed);
                return is;
            } catch (AmazonS3Exception e) {
                if (e.getErrorCode() != null && NO_RETRY_ERROR_CODES.contains(e.getErrorCode())) {
                    LOGGER.warn("Hit a no retry error code. Not retrying." + tries, e);
                    throw new IOException(e);
                }
                LOGGER.warn("client exception fetching on retry=" + tries, e);
                ex = new IOException(e);
            } catch (AmazonClientException e) {
                LOGGER.warn("client exception fetching on retry=" + tries, e);
                ex = new IOException(e);
            } catch (IOException e) {
                LOGGER.warn("client exception fetching on retry=" + tries, e);
                ex = e;
            }
            LOGGER.warn("sleeping for {} seconds before retry", throttleSeconds[tries]);
            try {
                Thread.sleep(throttleSeconds[tries]);
            } catch (InterruptedException e) {
                throw new RuntimeException("interrupted");
            }
            LOGGER.debug("trying to re-initialize S3 client");
            initialize(new HashMap<>());
        } while (++tries < throttleSeconds.length);

        throw ex;
    }
Fetches files from s3. Example file: s3://my_bucket/path/to/my_file.pdf
The bucket must be specified via the tika-config or before
initialization, and the fetch key is "path/to/my_file.pdf".
tika-pipes/tika-fetchers/tika-fetcher-s3/src/main/java/org/apache/tika/pipes/fetcher/s3/S3Fetcher.java