# \[ANN\] AWS Lambda Julia runtime

**URL:** <https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023>\
**Category:** Package Announcements\
**Created:** [April 11, 2021, 7:50am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023 "2021-04-11T07:50:55Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [April 11, 2021, 7:50am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/1 "2021-04-11T07:50:55Z")

</div>

Hello all,

I’ve seen the question of using Julia in AWS Lambda come up a few times in the past, but as far as I can see without any definite solution. AWS have built out their Lambda container functionality a bit since then, so I’ve tried to simplify the process of creating Julia docker containers - for use in AWS Lambda - here:

> **[GitHub - harris-chris/Jot](https://github.com/harris-chris/Jot#creating-a-lambda-user-role)**
>
> Contribute to harris-chris/Jot development by creating an account on GitHub.

Users can fill in entires in a short-ish config file, write their code into a function.jl file, then use bash scripts to create a local image, test that image, and then push it up to AWS and create a lambda function based on it, when the time comes.

Julia seems to work reasonably well here - cold-start times are not great (about 10 seconds), but from a warm start it is very fast, and not excessively memory-intensive.

For the time being I’ve only tested this on Linux. Any bug reports/issues welcome.

Chris

---

<div class="post-metadata">

**Author:** ![helgee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/helgee/32/2022_2.png) [@helgee](https://discourse.julialang.org/u/helgee)\
**Post date:** [April 11, 2021, 8:03am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/2 "2021-04-11T08:03:10Z")

</div>

Very interesting 👍 Thanks for putting this together!

You might want to bring PackageCompiler.jl into the mix to improve the cold-start times. See e.g. @dilumaluthge’s work here: [GitHub - JuliaContainerization/SimpleContainerGenerator.jl: Create container images for using Julia packages (especially useful in environments without Internet access)](https://github.com/bcbi/SimpleContainerGenerator.jl)

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [April 11, 2021, 8:16am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/3 "2021-04-11T08:16:43Z")

</div>

Thanks, yes - that’s an interesting package - I’m just looking at it and trying to figure out if it would help. At the moment I have the dependencies being precompiled at the stage of creating the docker image - does it offer performance gains beyond that?

---

<div class="post-metadata">

**Author:** ![helgee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/helgee/32/2022_2.png) [@helgee](https://discourse.julialang.org/u/helgee)\
**Post date:** [April 11, 2021, 8:40am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/4 "2021-04-11T08:40:26Z")

</div>

> [@harris-chris](#):
>
> does it offer performance gains beyond that?

Yes, absolutely! PackageCompiler.jl will generate a custom system image for the Julia compiler used in the container which will remove almost all of the start-up latency. Here is a nice example:

> <https://twitter.com/josef_heinen/status/1380169255639977990>

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [April 11, 2021, 8:51am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/5 "2021-04-11T08:51:10Z")

</div>

Chris, this ia really great.  
Functions As A Service - remember you heard it here first !

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [April 11, 2021, 9:00am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/6 "2021-04-11T09:00:09Z")

</div>

Ok, yes, that seems like quite a dramatic improvement. I’ll look at bringing this in.

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [April 11, 2021, 9:00am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/7 "2021-04-11T09:00:43Z")

</div>

Much appreciated!

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [April 11, 2021, 2:42pm UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/8 "2021-04-11T14:42:18Z")

</div>

I seem to remember one issue being the size of Julia and its dependencies surpassing some limits imposed by AWS. Is that no longer the case? How did you get around that? Or did Julia get smaller?

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [April 11, 2021, 4:59pm UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/9 "2021-04-11T16:59:33Z")

</div>

I think I posted about those limits. But now see this announcement!  
As an aside, I am told that if you have an Alexa then requests to Alexa are handled by lambdas. They eat their own dog food.  
Alexa! Integrate this function for me for values of 0 to 2pi

> **[New for AWS Lambda – Functions with Up to 10 GB of Memory and 6 vCPUs |...](https://aws.amazon.com/blogs/aws/new-for-aws-lambda-functions-with-up-to-10-gb-of-memory-and-6-vcpus/)**
>
> AWS Lambda runs your code on an highly available and scalable compute infrastructure so that you can focus on what you want to build. Do you want to get the advantages of Lambda for workloads that are memory or computationally intensive? Wait no...

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [April 11, 2021, 7:44pm UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/10 "2021-04-11T19:44:37Z")

</div>

Have you checked this?  
[https://github.com/tk3369/aws-lambda-container-julia](https://github.com/tk3369/aws-lambda-container-julia)

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [April 11, 2021, 10:34pm UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/11 "2021-04-11T22:34:25Z")

</div>

I think the Lambda container size limit used to be 250mb and has now been raised to 10GB (as of December last year). The images I’m getting are about 500mb so the previous limit would have been a problem.

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [April 11, 2021, 10:35pm UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/12 "2021-04-11T22:35:05Z")

</div>

No, which slightly surprises me, because I did a fair bit of googling on this topic.

---

<div class="post-metadata">

**Author:** ![Eric\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eric_smith/32/8088_2.png) [@Eric\_Smith](https://discourse.julialang.org/u/Eric_Smith)\
**Post date:** [February 10, 2022, 12:21pm UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/13 "2022-02-10T12:21:49Z")

</div>

I just found this work @harris-chris  
It looks amazing. 🌠  
Like John says, this is the future.

Ubiquitous functions. Callable by URL.  
The AWS Step Functions is a primitive implementation of chaining arbitrary functions.  
We need latency between functions to move closer to what they are when in the same runtime.

If we could wrap all the owner that is Julia into easily digestible lambdas, it would be easy for other to integrate into systems that have much more developed toolchains for this web world.

But this paradigm of polyglot functions is much bigger than that.  
We have ongoing discussions with AWS and have brought this up.

Best wishes and thanks for this Chris  
Eric

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [February 11, 2022, 1:54am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/14 "2022-02-11T01:54:45Z")

</div>

Thanks for your kind words Eric!

---

<div class="post-metadata">

**Author:** ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)\
**Post date:** [February 11, 2022, 5:50am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/15 "2022-02-11T05:50:10Z")

</div>

This will be even cooler when StaticCompiler.jl is more mature:  
[https://github.com/tshort/StaticCompiler.jl](https://github.com/tshort/StaticCompiler.jl)

it’s had a bunch of work lately

---

<div class="post-metadata">

**Author:** ![ilanggear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ilanggear/32/862_2.png) [@ilanggear](https://discourse.julialang.org/u/ilanggear)\
**Post date:** [March 21, 2023, 1:15am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/16 "2023-03-21T01:15:59Z")

</div>

I would love to use this package, but I’m a bit out of my element in setting it up. Currently I’m on step two, creating the local\_image, and getting two errors:

````julia
collectFormLemmas_package [4ad52ae1-b5e6-4573-96f0-52480c524a03]
...
ERROR: LoadError: ArgumentError: Package collectFormLemmas_package does not have Distributed in its dependencies:```

My code is a script, not a package, but the docs seemed to indicate that that should be fine. Any help would be very much appreciated.
````

---

<div class="post-metadata">

**Author:** ![harris-chris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/harris-chris/32/23877_2.png) [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Post date:** [March 21, 2023, 1:31am UTC](https://discourse.julialang.org/t/ann-aws-lambda-julia-runtime/59023/17 "2023-03-21T01:31:48Z")

</div>

Hello - yes, a script should be fine. From the error it sounds as though it may be trying to use the `Distributed` package, eg via `using Distributed`. If so, you will need to pass `dependencies=["Distributed"]` to the `create_responder` function. If you are able to share the script (the easiest way would be to open an issue on the Jot github page: `[https://github.com/harris-chris/Jot.jl/issues`]([https://github.com/harris-chris/Jot.jl/issues`](https://github.com/harris-chris/Jot.jl/issues%60))), then that might be helpful, but I know sometimes these things are proprietary.
