Architecture combinations between lambdas and layers

0

Hi,

Any information or insights into what combinations of architectures work between lambdas and the layers attached to them? For example I have a lambda with two attached layers. One layer is arm64, one is x86_64.

If the lambda is built as an x86_64 this all works. If it's built as an arm64 lambda it doesn't (unmet dependencies errors):

WORKS:            lambda (x86_64) -> layer1 (arm64) -> layer2 (x86_64)
DOESN'T:          lambda (arm64)  -> layer1 (arm64) -> layer2 (x86_64)

Runtime is Nodejs18.x for everything.

How do layers work anyway? I thought they were like "included" files, but the fact that shared libraries and so on can be included suggests they're more like compiled/linked binaries. Any pointers would be very interesting.

David

dmb0058
asked 8 months ago217 views
2 Answers
0

Lambda layers are just a way to add files to the lambda execution environment. All the files in the Layer (which is a zip file) are extracted to the /opt folder.

You should not mix them, however, if you are using a runtime like Python or Node which uses interpreted code, it may work. Python sometimes also includes binary dependencies, so that might cause issues. Not sure about Node.js.

profile pictureAWS
EXPERT
Uri
answered 8 months ago
0

Thanks Uri,

That fits with what I'm seeing.

My guess is that the architecture of the lambda is used to select the hardware that it's run on:

x86 lambda (Node) + ARM layer (Node) + x86 layer (binary) would work when unbundled onto an x86 processor because the Node elements would be interpreted appropriately on either platform but wouldn't work if deployed to an ARM processor because the binary layer wouldn't run.

David

dmb0058
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions