Lambda Layers
The Lumigo platform allows you to auto-instrument your Lambda functions with the help of Lambda layers. If you choose this option, the Lumigo layer will be added to your Lambda function.
Lambda Layers allow you to deploy common packages that you can reuse across all of your Lambda functions in the same region. Your code will be merged with these layers automatically by the Lambda service when you create or update your Lambda functions, so you don't need to worry about keeping libraries synced across all of your functions.
Click here to learn more about Lambda Layers!
Using Lambda Layers, you can configure all of your Lambda functions to pull the Lumigo tracer in as a Lambda layer, which allows you to exclude it from your deployment package.
Auto-Tracing
The Lumigo platform allows you to auto-trace your Lambda functions with the help of Lambda layers. If you choose this option, the Lumigo layer will be added to your Lambda function. This allows our tracer to operate on your Lambda handler without changing a single line of code. If you wish to manually add the Lumigo layer please follow the steps described below.
Manually installing the Lumigo Lambda Layer
- Copy the ARN from our GitHub repository:
Note
Copy the layer ARN that matches your Lambda functionโs region.
- Go to your Lambda function's page on the AWS console.
a. Click on "Layers"
b. Click on "Add a Layer"
- Choose to provide a layer version ARN, and paste the ARN you copied before.
- Click on "Add", and then "Save".
- Go back to the configuration tab of your Lambda, and add the following environment variables:
Key | Value |
---|---|
LUMIGO_TRACER_TOKEN | your lumigo token |
AND, one of the two variables, depending on the wrapping/redirection method:
Auto-Tracing using Lambda wrapper script (for NodeJS only, recommended)
Lambda wrapper script is a new addition to Lambda which allows customising the runtime startup behaviour. It is a more native approach to agent-less tracing, and is therefore more simple and robust. Lumigo Lambda wrapper scripts are currently available for NodeJS runtimes only.
AWS_LAMBDA_EXEC_WRAPPER | /opt/lumigo_wrapper |
If your runtime is Node.js 12.x or 10.x - you are done here.
Auto-Tracing using handler redirection (for Python and NodeJS)
If you're a Python or that for some other reasons you prefer to use handler redirection, please add the following environment variable and follow the next steps:
Key | Value |
---|---|
LUMIGO_ORIGINAL_HANDLER | your original handler |
- Change your lambda handler to the following:
- Node.JS - lumigo-auto-instrument.handler
- Python - /opt/python/lumigo_tracer._handler
- Hit "Save"
AWS Console Error Message
Please note that an error message regarding the function's handler will show up, due to an issue in the Lambda AWS console. Please disregard the following message:
- Lambda can't find the file lumigo-auto-instrument.js. Make sure that your handler upholds the format: file-name.method.
You may also see this message:
- Lambda can't find the file /opt/python/lumigo_tracer.py. Make sure that your handler upholds the format: file-name.method.
Both are safe to ignore
Updated over 3 years ago