AWS has officially released today, at re:Invent 2018, the support for Layers in Lambda functions.
Epsagon is proud to partner with AWS as an official partner of AWS Lambda Layers!
In short, Layers can include arbitrary code and data, which can be referenced and used by multiple Lambda functions. In fact, it allows developers to separate common modules and utils, that are being used by many functions, which results in slimmer deployments.
For every distributed software application, there are common code parts which need to be wrapped in every service, or a common library/dependency (from pip, npm, or other package managers). Sometimes it can even be data files. One way to solve it is to package them manually together in every service, every time we deploy. Layers allow us to separate these files into a different package, that will be added to every function under the /opt directory.
When using Epsagon for distributed tracing, Epsagon’s automatic instrumentation library should be imported. Instead of installing the library, you can now just add the Epsagon layer (currently supporting both Python and Node.js) via the AWS console or CLI, and then the Epsagon library will automatically be there!
To add a layer go into a function page and select the new Layers icon and click “Add new layer”:
Then select “Provide a layer version ARN”, and use the following layer, depends on your runtime language:
- Python: arn:aws:lambda:<same_region_as_function>:066549572091:layer:epsagon-python-layer:1
- Node.JS: arn:aws:lambda:<same_region_as_function>:066549572091:layer:epsagon-node-layer:1
And now you can just simply Epsagon via the Cloud9 IDE:
And everything is set for monitoring! To learn more about Layers you can check the documentation.
Layers is a great feature introduced by AWS, which brings a powerful way for developers to customize and improve their Lambda functions environments. It enables an even faster developer velocity and a more loosely coupled approach for functions.