Fork me on GitHub
#babashka
<
2021-01-21
>
steveb8n23:01:10

Q: is there a technique/example of using bb as an AWS lambda handler?

steveb8n23:01:50

would be simpler than setting up a Graal clj or java project. might be worth the perf tradeoff

steveb8n23:01:14

exactly like that. I’ll need to update it to get the latest bb with aws pods but that’s great.

borkdude23:01:57

Make sure to force downloading the pod so it's already available in the docker image

borkdude23:01:33

it's downloaded to $HOME/.babashka so you'd have to copy that dir inside the image after you call load-pod

steveb8n05:01:17

cheers for the tip!

borkdude07:01:10

Alternatively you can use a hard coded path in load pod

borkdude07:01:27

And download the pod yourself in Dockerfile

steveb8n08:01:59

I prefer the latter. I do all docker builds locally and that sounds simpler

lukasz23:01:33

New Docker runtime stuff should make it pretty easy to use bb in Lambda, no more layers etc

lukasz23:01:51

It boils down to doing a GET to get the args, and POST-ing the result: https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html

lukasz23:01:11

I think this is based on the "old" way of providing custom runtimes for Lambda, now you "just" build a container image and bundle whatever files and tools you need. The "layers" approach had some limitations in terms of size and what you can actually ship

lukasz23:01:41

but, that namespace does look handy - I think AWS just opened up all the nitty gritty of how Lambdas are put together by introducing Docker support

lukasz23:01:03

needless to say, I'll be trying it out as we need to replace a couple of Lambdas using the Java runtime

steveb8n23:01:45

that’s good to know. I’ll try pure docker as well