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
已提問 9 個月前檢視次數 239 次
2 個答案
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
專家
Uri
已回答 9 個月前
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
已回答 9 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南