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

  1. Copy the ARN from our GitHub repository:

๐Ÿ‘

Note

Copy the layer ARN that matches your Lambda functionโ€™s region.

  1. Go to your Lambda function's page on the AWS console.
    a. Click on "Layers"
    b. Click on "Add a Layer"
1798
  1. Choose to provide a layer version ARN, and paste the ARN you copied before.
  2. Click on "Add", and then "Save".
1034
  1. Go back to the configuration tab of your Lambda, and add the following environment variables:
KeyValue
LUMIGO_TRACER_TOKENyour 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:

KeyValue
LUMIGO_ORIGINAL_HANDLERyour original handler
1406
  1. Change your lambda handler to the following:
  • Node.JS - lumigo-auto-instrument.handler
  • Python - /opt/python/lumigo_tracer._handler
1405
  1. 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

1829

You can ignore this error

1588

You can also ignore this error