This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-24
Channels
- # announcements (1)
- # aws (140)
- # beginners (41)
- # calva (47)
- # cider (43)
- # clj-kondo (36)
- # clojure (178)
- # clojure-europe (12)
- # clojure-gamedev (2)
- # clojure-italy (1)
- # clojure-nl (17)
- # clojure-russia (3)
- # clojure-spec (37)
- # clojure-uk (97)
- # clojurescript (173)
- # core-async (16)
- # cursive (18)
- # data-science (2)
- # datascript (6)
- # datomic (32)
- # dirac (16)
- # duct (16)
- # events (2)
- # figwheel-main (7)
- # fulcro (8)
- # graalvm (18)
- # immutant (3)
- # joker (2)
- # kaocha (8)
- # nrepl (6)
- # nyc (2)
- # off-topic (62)
- # quil (3)
- # re-frame (18)
- # reitit (6)
- # ring-swagger (1)
- # shadow-cljs (119)
- # spacemacs (4)
- # specter (2)
- # tools-deps (10)
- # vim (58)
- # xtdb (9)
For those who use AWS, which of these is the preferable lib to use? https://github.com/cognitect-labs/aws-api https://github.com/mcohen01/amazonica
they are very different approaches
amazonica is a clojure wrapper for the Java SDK
aws-api is a data-oriented and data-driven Clojure API directly to the AWS http api
that has been discussed
I don't know the status of it
^^ the issue to follow
you would need a cljs http library instead (maybe other things too, I don't know)
conceptually there is no reason that can't work afaik
we are making moves towards being able to being able to support cljs but cljs isn’t in the short term milestones
I don't think amazonica does that for cljs
seems like that would be the obvious thing to do
Signing routines are not terribly complicated, but we’re trying to move forward everything compatibly
What sorts of dependencies are you interested in running within lambda? Sorry for the 20 questions, doing research :)
I’m in the preliminary infra planning stages so this may change and may be incomplete, but I’m mainly looking at using the RDSDataServer API to access an Aurora Serverless SQL cluster
One thing to consider is if you need to run lambdas in VPC, which would increase the cold start time
It allows lambda to talk to services that are inside a VPC that are not accessible from outside
AWS launched optimizations for cold starts for lambdas in VPC few weeks ago, so I don’t know the current situation. It used to be in order of few seconds for cold starts and no difference in warm starts, if I remember correctly.
https://aws.amazon.com/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/
basically there is a json based datastructure for all the api's but I'm not aware of a complete doc reference.
> Each AWS SDK has its own copy of the data descriptions in their github repos. We use aws-sdk-js as the source for these, and release individual artifacts for each api.
Editorial: I’m all for faster startup times, but cold start is talked about way too much without surrounding use-cases
if people are using it, then things aren't cold right?
That keeps one lambda instance warm, you’ll get cold starts if you happen to need more than one simultaneously.
This coldstart thing is almost never an issue unless you have a thundering herd scenario.
If you make a heartbeat lambda which heartbeats all your other possible lambdas then this is solved, right?
start times depend on lot of things, like jar size. cold starts are faster in clojurescript, and warm starts are faster in clojure. Clojure(script) has some extra start time cost on top of nodejs/jvm.
also low memory lambdas have more varying performance than higher memory (more expensive) lambdas. That is you get some minimum amount of cpu but might get more if you are lucky.
if cold starts are your problem, then isn't the real problem no one is using your stuff?
I’ve made this leiningen template to help creating lambda projects for clojure: https://github.com/jsyrjala/aws-lambda-serverless/
Mostly lambdas I have done are backend stuff where cold starts do not matter at all.
@mruzekw I was pointed to this repo recently when looking for clj on AWS Lambda resources: https://github.com/StediInc/lambda. Looks useful, haven't used it.
I’m trying to follow this tutorial, but they don’t provide how to correctly invoke the lambda from the AWS CLI
I’m using:
aws lambda invoke --function-name clj-hello --payload '{"body": "Will"}' /dev/stdout
But I get back:
{"errorMessage":"An error occurred during JSON parsing","errorType":"java.lang.RuntimeException","stackTrace":[],"cause":{"errorMessage":"com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: lambdainternal.util.NativeMemoryAsInputStream@4516af24; line: 1, column: 1]"
Does anyone know the expected shape of the JSON payload given:
(ns hello
(:gen-class
:methods [^:static [handler [String] String]]))
(defn -handler [s]
(str "Hello " s "!"))
I've hit that before. It has to do with the signature of your Java lambda fn. I remember having to switch to the input/output stream signature. Googling that exception gives you some answers IIRC.
➜ aws lambda invoke --function-name clj-helloooo --payload 'Will' /dev/stdout
An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Unrecognized token 'Will': was expecting ('true', 'false' or 'null')
at [Source: (byte[])"Will"; line: 1, column: 9]
Quick question/poll: Which would you all choose for a lambda with an avg response time <300ms, CLJ (with or without heartbeat warmer) or CLJS?