Fork me on GitHub
#aws
<
2022-04-05
>
Benjamin14:04:36

Hello I'd like to make a "v4 signed" http request. Is there a snippet out there or something in cognitect-api that already does that?

Daniel Craig18:04:10

I have this same need but I haven't settled on how to do it yet

Daniel Craig18:04:08

For me I want to make a request to a neptune streams endpoint, and a signed request is the way to do that

Benjamin11:04:42

In a simple use case I was able to use nbb + got4aws

Benjamin11:04:32

(ns
    script
    (:require
     ["got4aws$default" :as got4aws]
     ["aws-sdk$default" :as AWS]
     [applied-science.js-interop :as j]
     [promesa.core :as p]))


(p/let
    [opts
     (nbb.core/slurp "options.edn")
     opts
     (read-string opts)
     client
     (got4aws
      (clj->js
       {:providers (clj->js
                    (AWS/SharedIniFileCredentials.
                     (clj->js (:creds opts))))
        :service "execute-api"
        :region "us-east-1"}))
     result
     (->
      client
      (.post
       (:url opts)
       (clj->js
        {:json  .... })))]
    (prn
     (js->clj
      (j/get-in
       result :body)))
    (println))

Daniel Craig21:04:06

I'm looking into NeptuneNettyHttpSigV4Signer from the aws neptune sdk for my use case