# AWS's Lambda Layers allows custom runtimes, lambdas for any language

**URL:** <https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692>\
**Category:** Show and Tell\
**Created:** [December 4, 2018, 2:20pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692 "2018-12-04T14:20:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![charliek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/charliek/32/3865_2.png) [@charliek](https://discourse.elm-lang.org/u/charliek)\
**Post date:** [December 4, 2018, 2:20pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/1 "2018-12-04T14:20:06Z")

</div>

I wasn’t at re:invent this past week but I did hear the announcement of an addition to AWS Lambda called [AWS Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html).

> A layer is a ZIP archive that contains libraries, a [custom runtime](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html), or other dependencies.

> You can implement an AWS Lambda runtime in any programming language. A runtime is a program that runs a Lambda function’s handler method when the function is invoked.

In short, it sounds like it’s now possible to create Elm lambda functions in AWS as long as there’s a custom Elm runtime available. I think this would be great to have. I’m interested to hear what the Elm community thinks.

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [December 4, 2018, 9:47pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/2 "2018-12-04T21:47:38Z")

</div>

Sounds good.

It was already possible to write AWS Lambda functions - I don’t think Elm needs much ‘customization’ to its runtime. In 0.18 there was a package called something like `elm-serverless`? You could use it to write AWS Lambda functions, but it has not been upgraded to 0.19.

---

<div class="post-metadata">

**Author:** ![Dan\_Abrams](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dan_abrams/32/3171_2.png) [@Dan\_Abrams](https://discourse.elm-lang.org/u/Dan_Abrams)\
**Post date:** [December 4, 2018, 10:25pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/3 "2018-12-04T22:25:16Z")

</div>

I’ve had a serverless elm app running in production for about two months. There’s one or two gotchas but it works well.

The issue isn’t getting elm to run, there’s no ecosystem or api design for serverside stuff.

My serverless app was a stop-gap measure. Most of the functionality implemented in the app is moving to the client side in the next iteration, but we didn’t have time to implement for launch, so we replaced our existing serverless node.js server with this temporary elm one.

On the other hand, I really love the idea of being able to write pure functions in Haskell, or use the excellent language constructs in elixir on serverless.

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [December 5, 2018, 10:37am UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/4 "2018-12-05T10:37:50Z")

</div>

Here is the `elm-serverless` package for 0.18:

[https://package.elm-lang.org/packages/ktonon/elm-serverless/latest/](https://package.elm-lang.org/packages/ktonon/elm-serverless/latest/)

I’m now curious as to why it hasn’t made it to 0.19, was there some reason it could not be upgraded? I don’t think this package included any kernel code, but it does have `src-bridge` which is some js that wraps the Elm runtime. Changes to the Elm runtime might well have broken that.

> [@Dan\_Abrams](#):
>
> The issue isn’t getting elm to run, there’s no ecosystem or api design for serverside stuff.

I think the idea was that you call AWS services over their HTTP APIs.

---

<div class="post-metadata">

**Author:** ![choonkeat](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/choonkeat/32/1555_2.png) [@choonkeat](https://discourse.elm-lang.org/u/choonkeat)\
**Post date:** [December 5, 2018, 4:41pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/5 "2018-12-05T16:41:23Z")

</div>

> [@charliek](#):
>
> what the Elm community thinks

Since there’s currently “no ecosystem or api design for serverside stuff” to speak of, I think it might be quite equalising for elm to start her backend journey from constrained environment like aws lambda or even cloudflare workers [than starting in more general server environments]

I’m experimenting with elm on “server side” and I’m liking how elm can make “http routes” handling much better than standard url/middleware approaches; looking forward to more discoveries in this space.

The [lack of parallel Task execution](https://discourse.elm-lang.org/t/task-map2-and-independent-asynchronous-operations/2471/4) does mean an elm version of the [canonical “google search”](https://youtu.be/f6kdp27TYZs?t=1723) be slow, albeit concurrent.

---

<div class="post-metadata">

**Author:** ![Dan\_Abrams](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dan_abrams/32/3171_2.png) [@Dan\_Abrams](https://discourse.elm-lang.org/u/Dan_Abrams)\
**Post date:** [December 5, 2018, 7:12pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/6 "2018-12-05T19:12:33Z")

</div>

> [@choonkeat](#):
>
> I’m experimenting with elm on “server side” and I’m liking how elm can make “http routes” handling much better than standard url/middleware approaches; looking forward to more discoveries in this space.

Honestly, I used elm/url to parse the urls into Routes, and with some very slight tweaks, it worked really, really well.

---

<div class="post-metadata">

**Author:** ![choonkeat](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/choonkeat/32/1555_2.png) [@choonkeat](https://discourse.elm-lang.org/u/choonkeat)\
**Post date:** [December 5, 2018, 11:35pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/7 "2018-12-05T23:35:40Z")

</div>

> used elm/url to parse the urls

Yes, same here `elm/url` is really good! But instead of keeping routes light, I’m finding value in loading more upfront work there – decoding headers and jwt into useful “request context” of custom types – then we could immediately do useful things when we start handling

```
( GET, Ok ({ userAgent, acceptLanguage } as context), Routes.Homepage ) ->
    ...
( GET, UserFromJWT, Routes.Homepage ) ->
    ...

```

> looking forward to more discoveries in this space

I’m also experimenting with exposing only `Task` for the Elm SPA (instead of thinking in terms of http and url). But this seamlessness “worked too well”: sharing type encoder/decoder is nice but client code can get conflated with with server code; need more work on developer ux

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [December 15, 2018, 11:47pm UTC](https://discourse.elm-lang.org/t/awss-lambda-layers-allows-custom-runtimes-lambdas-for-any-language/2692/8 "2018-12-15T23:47:25Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
