2 years ago
#357497

alayor
How can I share code between AWS Lambda Layers?
I understand that you can share code among AWS Lambda functions when those functions use the same layer.
However, I want to reuse code among Lambda Layers.
Can I just reference the /opt/nodejs/ folder inside my layer code in order to access another layer code hoping that both layers are being used by the same Lambda function?
E.g.
layer1 --> /myFile1.ts
layer2 --> /myFile2.ts
myFunction uses both layer1 and layer2.
Can I do the following in my /myFile1.ts in order to use the /myFile2.ts code?
import * as _ from 'opt/nodejs/layer2/myFile2.ts'
node.js
amazon-web-services
aws-lambda
aws-lambda-layers
0 Answers
Your Answer