portkey

Portkey: from REPL to Serverless in one call
viesti 2020-06-02T14:14:18.001200Z

humdum

viesti 2020-06-02T14:21:22.003600Z

looking at https://github.com/StediInc/lambda, wondering if the generated jar would be fed to Graal native-image, and the library would generate a handler that works with the Lambda custom layer machinery...

valtteri 2020-06-02T16:30:20.004700Z

I’ve been eyeballing this https://github.com/dainiusjocas/babashka-lambda-layer

valtteri 2020-06-02T16:31:54.006600Z

Babashka can already do all kinds of things.. Just wondering if there was a lambda-layer that had babashka and AWS Command-Line Client.. That would cover a huge chunk of my lambda-needs. With native speed of course. 🙂

valtteri 2020-06-02T16:33:36.007Z

While having a Clojure-like language and dev-experience

valtteri 2020-06-02T16:34:34.007700Z

I’ll look into this during holidays

viesti 2020-06-02T18:49:30.008Z

ah, aws pod

viesti 2020-06-02T18:49:37.008300Z

that would be neat

viesti 2020-06-02T18:50:07.008600Z

pods as layers, hmm...

viesti 2020-06-02T18:54:42.009800Z

random google: https://github.com/aws-samples/aws-lambda-layer-awscli

viesti 2020-06-02T18:54:57.010400Z

didn't check if that is v2 cli though

viesti 2020-06-02T18:56:14.012200Z

so I haven't actually used lambda layers, but trying to remember if they were stackable and if so, a bb layer ontop of that would be neat...

viesti 2020-06-02T18:58:47.012800Z

hmm, I guess one can combine those two

viesti 2020-06-02T19:17:43.013200Z

0% cat handler.clj
(ns handler
  (:require [clojure.java.shell :refer [sh]]))

(defn handle [event context]
  (println (sh "/opt/awscli/aws" "sts" "get-caller-identity"))
  (assoc event "babashka" "rocks even harder"))
0% make invoke
START RequestId: c4e9f43c-da50-49b4-84ba-1c49a3af8cb7 Version: $LATEST
{:exit 0, :out {
    "Account": "096681235511",
    "UserId": "AROARNAVGSQ35VYJVCMF7:babashka-lambda-example",
    "Arn": "arn:aws:sts::096681235511:assumed-role/hello-role-qryue13v/babashka-lambda-example"
}
, :err }

viesti 2020-06-02T19:17:46.013400Z

laalaa

viesti 2020-06-02T19:20:05.015400Z

had forgotten about the SAR thing, installs layers via CloudFormation, just few clicks and you have babashka layer + awscli layer on your account, then copy ARNs to the babashka laer example Makefile and off you go 🙂

viesti 2020-06-02T19:20:52.015600Z

ah and bb has cheshire built in

viesti 2020-06-02T19:24:17.016300Z

0% cat handler.clj
(ns handler
  (:require [clojure.java.shell :refer [sh]]
            [cheshire.core :as json]))

(defn handle [event context]
  (-> (sh "/opt/awscli/aws" "sts" "get-caller-identity")
      :out
      (json/parse-string true)
      :UserId
      (println "says hi!")))
0% make invoke
START RequestId: a170b304-b30a-42ea-a194-d423e94ea843 Version: $LATEST
AROARNAVGSQ35VYJVCMF7:babashka-lambda-example says hi!

🦜 2
viesti 2020-06-02T19:28:01.016700Z

Thanks for the idea valtteri! 🙂