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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则