Elixir on AWS Lambda

We recently released the open-source SCAR framework that can run containers out of Docker images on AWS Lambda. We have included an use case to run Elixir code in AWS Lambda, just as a proof of concept of supporting programming languages (and runtime environments) other than those officially supported by AWS Lambda. Just in case you may be interested.

5 Likes

What about the max execution time of a lambda function? as its not unlimited, then it will be impossible to have a living elixir process, right?

This is true. Lambda while cool negates some of the benefits you get from running elixir.

1 Like

A bit of an old thread, but apparently an announcement was made at reinvent that support is coming (or was just made available). https://blog.alertlogic.com/new-runtimes-provided-by-alert-logic-widen-the-playing-field-for-aws-lambda/

Above is the reinvent announcement and the foundation of the Alert Logic offerings. Alert Logic is a partner that is leveraging the new Lambda Runtime API to deliver a packaged solution for Elixir. I would assume that layers can be leveraged in the future for common libs and features. Similar to how deep learning python packages were deployed to assist python lambdas with deep learning tasks. What would be nice layers for Elixir? Ecto? The Elixir based deep learning Tensorflow bindings?

Lambdas can also now be fronted directly by a public HTTP(s) load balancer. So check that out too. (although if you’re handling a lot of requests, it will still likely be cheaper not to use lambda).

We also have a thread specifically about the announcement of “official” lambda support: Elixir on AWS Lambda is coming soon

3 Likes

What I don’t understand is:
Isn’t one of elixirs big features that it can trigger subprocesses easily to a whole cluster of elixir mashines and if one of the nodes fails its not a deal at all and the process is taken over by another node?
Wouldn’t that feature be completely lost? I understand that Lambda provides all sorts of mechanisms to deal with concurrent calls and also infrastructure for dealing with failures 
 isn’t the only advantage left a nicer syntax and maybe a more stable eco system?

That is true but with the traditional Elixir way you need to have a server, or a cluster, that is able to handle traffic peaks. So you get this costly machine that has some CPUs and some GBs of RAM, but most of the time it runs for nothing.

With serverless you only use machines when required, and it “automatically” scales with huge traffic peaks.

That being said I am not working on such successful app so for me a persistent running server is good enough and allows to benefit from all Elixir and BEAM features.

Is there a way to warmup Elixir with AWS ? I mean the VM has slow startup times (compared to a simple PHP script or a JS lambda that will start executing code almost instantly).

2 Likes

Yes, there is a way 
 in the past you would use the serverless-warmup plugin in case you use serverless framework. That would spin another funtion calling your function every 5 minutes.
But AWS has a build in feature now, a simple flag provisionedConcurreny={n}.
This will make sure that you always have {n} amounts of lambdas ready and warm.

(also available in never serverless framework versions)
I am not 100% sure if that also means that the BEAM is always ready as well since it runtime is on a diffent layer, but I assume it would.
Let us know if it works.

2 Likes