Fork me on GitHub
#aws
<
2020-06-11
>
kenny22:06:52

Anyone know if there's an aws-api for invoking an API Gateway endpoint that is secured with AWS_IAM (it needs all requests to be signed)?

kenny23:06:35

Hmm, I'm pretty close to getting it to work...

(signers/v4-sign-http-request
  {:metadata {:signingName "execute-api"}}
  {:region "us-west-2"}
  {:aws/access-key-id     "..."
   :aws/secret-access-key "..."}
  {:method         :post
   :request-method :post
   :uri            invoke-url
   :headers        {"content-type" "application/json"
                    "host"         ""
                    "x-amz-date"   (aws.util/format-date aws.util/x-amz-date-format (Date.))}}
  :content-sha256-header? true)
The AWS response tells me "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.". I'm somewhat certain this has to do with the host header.

ghadi23:06:48

disclaimer, that namespace is not public

ghadi23:06:02

and we will randomly break it

kenny23:06:33

I know... After getting it to run through, I can pull the relevent pieces out 🙂

goedelsoup23:06:50

i'm surprised how bad these docs are