Yan Cui
1 min readMar 26, 2019

--

Yes, but layer just changes the way the dependency is baked into your execution environment. As you can see from the no-aws-sdk case (which also had both AWS SDK and XRay SDK in the node_modules folder), having the dependencies doesn’t add Initialization time. It’s what you do with them.

This behaviour is further enforced by how the difference we see between the DynamoDB and full AWS SDK results.

Also, I have some reservations regarding the use of Layers in general, more details here: https://lumigo.io/blog/lambda-layers-when-to-use-it/ Although for something like the AWS SDKs, whose API is very stable I don’t actually have strong objections to using Layers. If you also install the same SDK version as devDependencies then you also sidestep the problem with running your code locally.

--

--

Yan Cui
Yan Cui

Written by Yan Cui

AWS Serverless Hero. Follow me to learn practical tips and best practices for AWS and Serverless.

No responses yet