fireproofsocks

fireproofsocks

Elixir on AWS Lambda? Or more broadly: Elixir as a Service

I’m not a Lambda fan-boy because I think it’s overprescribed as a cure-all for every possible problem when in reality, Lambdas are best suited for a narrower scope of tasks. Generally I wouldn’t think any VM-centric language would be a good fit for a Lambda because they would have a larger footprint and may take longer to start, but Java has been one of the Lambda options for a long time. So… clearly there’s more to the story.

Anyhow, because Lambdas often get brought up any time there’s a conversation about “serverless” deployments, I think they are a worthy topic of discussion.

There’s an old thread about Elixir on AWS Lambda: Elixir on AWS Lambda is coming soon

but I haven’t seen much on it recently. There’s even the aws_lambda_elixir_runtime Hex package, but it hasn’t been updated in quite a while (e.g. it uses Distillery instead of releases).

Ironically, I have had to think a lot MORE about the infrastructure when I use tools like serverless. However, one can’t ignore the push towards deploying apps in the context of various cloud services, so IaC tools are hard to ignore. I’m curious what people are thinking or have seen with respect to Elixir deployments and Elixir as a service. It would be nice to have easier deployments. Gigalixir is a great platform-as-a-service, but I’m wondering if there’s room for more tooling something that might a bit more like serverless or chalice that deals with automating the painful AWS permissions around getting something deployed.

Most Liked

StorageCluster

StorageCluster

there has been an update on the Elixir “native” on AWS Lambda. There is a project by @bmalum called Mayfly - just discovered it on https://elixir-aws-lambda.dev works well - sadly no Hex Package yet but runs with Elixir 1.19.3

Sebb

Sebb

The startup is only an issue if you have few requests and the lambda has to cold-start. You can keep the lambda “warm” to not have to cold-start.

But I would not use Elixir as a lambda. It seems a little hacky. But more important, lambdas are usually used as very specialized functions. You have to build a system around it. Elixir/OTP is very good at just that: building a system. You’d give that up and make everything more complicated than needed. Depends on the use case obviously.

dergraf

dergraf

Not an answer, more of an experience report :wink:

I’ve played at some point with AWS Lambdas written in Elixir, first by using one of the mentioned libraries and second by rolling it on my own using just HTTPoison. It made me realize how simple the architecture actually is or can be (assuming the official Lambda stacks do more or less the same as I did).

But that was only an experiment. Today we live with a mixed codebase of Javascript and Python based Lambdas used as custom Authorizers in AWS API Gateway. All our Lambdas are deployed using Terraform aws_lambda_function module. To make this work with plain Terraform we must store the Lambda dependencies, e.g. JS node_modules folder, in the same directory as the actual Lambda code, all checked into Git. :weary:

Separating the Lambda code from Terraform could solve this issue, which would be possible with the other Lambda flavors; deployment packages on AWS S3 or container images on AWS ECR. In contrast to the simple zip based approach, one must introduce a whole new process to separately test, build, and deploy those artifacts (but that’s what we do for our Elixir apps anyways, right).

I think if a Lambda codebase gets bigger, their dependencies more complex, using a separate CI/CD process for Lambdas outside of IaC becomes inevitable. We’re not at this point yet, but once we are, I would definitely do another round of experimentation with Elixir based Lambdas.

Last Post!

bmalum

bmalum

Got your mention notification, thanks for advertising it. The project will be published on Hex.pm in the future. Benchmarks are a great idea – if time permits, I plan to put together a small comparison to make the trade-offs more transparent.

Cold starts are definitely a topic, but in my tests with larger applications they were consistently below 2 seconds. If that is still an issue and you want to stay with Elixir on AWS Lambda, using provisioned concurrency (around $4.50/month for a single always-warm instance) effectively eliminates the cold start problem. For my use case, the cold start overhead is acceptable and does not impact the workload significantly

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
f0rest8
Hi everyone :waving_hand: Posting here to showcase and announce that Metamorphic is now officially live on a public-facing domain at htt...
New
andrielfn
Hey there :waving_hand: I want to introduce Fluxon UI, a modern UI component library for Phoenix LiveView that I have been working on fo...
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
webofbits
Squid Mesh is an open source workflow automation runtime for Elixir applications. It is aimed at Phoenix and OTP apps that want to defin...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
kip
In 2021 I started a new library called Tempo with the objective of modelling time as a set of intervals - not as instants. In 2022 I gave...
New

We're in Beta

About us Mission Statement