Skip to main content

AWS Lambda Layer

Using Epsagon's Layers in Lambda#

Our layers are publicly available for Python and Node.js Lambda runtimes. With just a few Environment Variables, the layer will automatically add tracing to your functions.

cURL with query parameters:

  • region=REGION
  • name=epsagon-LANGUAGE-layer
  • max_items=1

to fetch the latest layer ARN. Choices for REGION include all AWS regions. Choices for LANGUAGE include python and node.

For example, to get the latest layer for Node.js in us-east-1: The endpoint would become

fetch(  "")  .then((r) => r.json())  .then((r) => r.LayerVersions[0].LayerVersionArn);

The ARN has a format of arn:aws:lambda:REGION:066549572091:layer:epsagon-LANGUAGE-layer:VERSION Add this layer to your function, and finalize tracing with environment variables.

For Zip Archives#

Add the layer with its ARN to the lambda function, and the function is good to go!

For Container Images#

A bit of processing is needed to add the layer to the container. Start by obtaining the ARN for the layer.

FROM alpine:latest as layer-copy
ENV EPSAGON_TOKEN=<TOKEN># Auto-Tracing env vars

RUN apk add aws-cli curl unzip
RUN mkdir -p /opt
RUN curl $(aws lambda get-layer-version-by-arn --arn LAYER-ARN --query 'Content.Location' --output text) --output epsagon-layer.zipRUN unzip -d /optRUN rm

FROM scratchWORKDIR /optCOPY --from=layer-copy /opt .

And the layer has been added to your image container. From there, define your image as needed!

Environment Variables#

Configure Environment Vars for Node or Python auto-tracing. EPSAGON_TOKEN=TOKEN EPSAGON_APP_NAME=APP_NAME

(python only) AUTOWRAPT_BOOTSTRAP=epsagon

(node only) NODE_OPTIONS='-r epsagon-frameworks'