fireproofsocks

fireproofsocks

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.

Showing Posts 1 to 9

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.

fireproofsocks

fireproofsocks OP

Agreed. I guess I’d say the same thing about Lambdas used as a webserver with routes etc. I’d rather have a on-demand EC2 instance or something. I wonder if you could have a BEAM instance running and have ad-hoc modules hot-loaded into it as needed. That’s really getting out there though…

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.

Sebb

Sebb

lambda deployment is not fun. We use serverless, thats ok.

WilliamSpain

WilliamSpain

Hi @dergraf, if you can remember what you did, would you be able to elaborate on how you managed to get elixir running on AWS Lambda for even a basic Hello World response. I have been trying something similar but struggled to get something running that didnt seem extremely hacky.

Im not a super proficient Elixir programmer but I was trying to use escript, burrito, and distillery, however with my approach runs into errors such as the following when I test my function.

/var/task/erts-15.1.2/bin/epmd: /lib64/libc.so.6: version `GLIBC_2.38' not found (required by /var/task/erts-15.1.2/bin/epmd)
/var/task/erts-15.1.2/bin/beam.smp: /lib64/libgcc_s.so.1: version `GCC_12.0.0' not found (required by /var/task/erts-15.1.2/bin/beam.smp)

Im hesitant to just jam in more dependencies as it feels like the wrong approach and it looks like my zip folder for my lambda will be significantly larger than what I was able to do when I tried the same in Haskell.

dergraf

dergraf

Hi!

I was using a containerized lambda instead of the classic zip file, see Create a Lambda function using a container image - AWS Lambda. this requires the containerized application to poll the AWS Lambda runtime for requests to be run, this is done using a Lambda runtime client, several libraries exists for this, but honestly it’s (was) two separate HTTP requests that were very straightforward to implement.I think I’ve started with this library GitHub - aws-samples/aws-lambda-elixir-runtime: Example implementation of a custom runtime for running Elixir on AWS Lambda. · GitHub.

Best,

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

StorageCluster

StorageCluster

just tested it in production - cold start execution seems fine with Mayfly which was 1.2s for me compared to Java Lambda it is very good, to native Node v22 it is “slow” which is 315ms. Every “warm” execution was <2ms for “Hello Elixir” Sample, which is was even faster than the native Node 22 Lambda (same output) at 3ms. @bmalum if you are still active here - maybe can you add a benchmark to the website?

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

— All posts loaded —

Where Next? Top

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...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews