AWS Neptune bulk load endpoint results in 403 every time

I'm trying to bulk load data by hitting the neptune bulk load endpoint:

  private void upload(String source) throws URISyntaxException, IOException {
    String jsonReq = createJson("s3://" + source);
    InputStream inputStream = new ByteArrayInputStream(jsonReq.getBytes(StandardCharsets.UTF_8));

    Request<Void> req = new DefaultRequest<>("neptune-db");
    req.setHttpMethod(HttpMethodName.POST);
    req.setEndpoint(new URI("https", null, HOST, 8182, "/loader", null, null));
    req.setContent(inputStream);
    req.setHeaders(Map.of("host",
        HOST,
        "Content-Type",
        "application/json",
        "x-amz-content-sha256",
        "required"));

    AWS4Signer signer = new AWS4Signer();
    signer.setRegionName(region);
    signer.setServiceName(req.getServiceName());
    signer.setOverrideDate(new Date());
    signer.sign(req, getCreds());

    httpClient.requestExecutionBuilder().request(req).errorResponseHandler(new ErrorResponseHandler()).execute();
  }

I keep getting 403. The same request works in AWScurl and postman. What could be missing in this case? I can see the tokens getting pulled for the signing.



Read more here: https://stackoverflow.com/questions/68477444/aws-neptune-bulk-load-endpoint-results-in-403-every-time

Content Attribution

This content was originally published by John at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: