This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-29
Channels
- # aws (16)
- # beginners (14)
- # boulder-clojurians (1)
- # braveandtrue (184)
- # cider (9)
- # cljs-dev (17)
- # cljsrn (10)
- # clojure (70)
- # clojure-austin (16)
- # clojure-finland (2)
- # clojure-germany (4)
- # clojure-italy (6)
- # clojure-nl (6)
- # clojure-sanfrancisco (2)
- # clojure-spec (5)
- # clojure-uk (60)
- # clojurescript (82)
- # cursive (1)
- # data-science (1)
- # datomic (13)
- # defnpodcast (1)
- # docker (82)
- # figwheel-main (18)
- # fulcro (51)
- # funcool (6)
- # jobs (13)
- # jobs-discuss (5)
- # jobs-rus (7)
- # juxt (2)
- # leiningen (4)
- # lumo (5)
- # mount (1)
- # off-topic (38)
- # pedestal (9)
- # re-frame (13)
- # reagent (16)
- # shadow-cljs (70)
- # spacemacs (5)
- # specter (9)
- # sql (8)
- # tools-deps (2)
- # vim (6)
Hello, is it there an easy/elegant way to sign a spandex (elasticsearch) request with an AWS signature? (I'm using aws-sig4 + clj-http at the moment)
Hi @n.duchenne I’m not aware of any easy way but you can look for hints here https://github.com/portkey-cloud/aws-clj-sdk/blob/master/src/portkey/awssig.clj
What comes to Spandex, I think you can slip in your custom headers when making the request
Thanks @valtteri, that's useful indeed; I had been looking for such functions. I'll check the custom headers. Otherwise, maybe I could use spandex's proxy feature, and either use one of the simple command-line AWS signing proxies that are around, or write my own proxy with the signing functions you pointed out. I'd welcome recommendations/warning about ready-made signing proxies before I embark on coding mine though.
I have no experience on proxies, but it sounds like maybe a good idea if writing your own turns out nasty. One option is to ditch Spandex and use client that knows how to sign requests for AWS.
Yes, given that it's just REST, using such a client might be the way to go. I'm browsing the code of the aws-clj-sdk to see whether it does this. Do you know? Or any other client?
I’ve used AWS ES only with Node where there are many client libs that can talk with AWS and currently I’m using non-AWS ES with Spandex. Nice that you found something useful and let me know if you get it to work with Spandex. 🙂
Looks like there are nice things in Node indeed, including a signing proxy that could work with Spandex https://www.npmjs.com/package/aws-es-proxy. Will investigate and let you know.
When we were doing microservices we setup a lambda with API-GW and created custom REST-interface for ‘our search’ that hid the ES-interface and exposed only use-cases that were relevant to us. We also used lambdas to index docs into ES directly from DynamoDB streams.
I think this was the client lib I used in the lambdas https://www.npmjs.com/package/aws-elasticsearch-client
Could have been this as well.. Can’t remember for sure 🙂 https://www.npmjs.com/package/http-aws-es
Well, @valtteri, using a third-party proxy proved straightforward. I installed node.js and the aws-es-proxy package on my EC2 instance, and then it was as simple as starting the proxy
aws-es-proxy
and then using localhost:9200
as host with spandex
(require '[qbits.spandex :as s])
(def c (s/client {:hosts [""]}))
(s/request c {:url [:testindex] :method :put :body {:settings {"number_of_shards" 1}}})
(s/request c {:url [:testindex] :method :get})
Not full clojure solution that I wished for, but it's so simple that I'll take it for now.