AWS Lambda Serverless Agent - Setup & Installation Docs | Middleware
This guide walks you through instrumenting AWS Lambda with OpenTelemetry and Middleware. These instructions can also be found on the Installation page in your Middleware Account.
Python Version
Python 3.8
and Python 3.9
Java Version
Java 8
, Java 11
, and Java 17 (Corretto)
Node.js Version
Node.js v14+
layer-collector/
Navigate to the opentelemtry-lambda repository and access the layer-collector
Copy the Amazon Resource Name (ARN) and set the configuration to match the AWS region and CPU architecture of your lambda function like the following example:
Navigate to Lambda -> Functions -> YOUR_FUNCTION -> Layers and click Add Layer
Navigate to Choose Layer and specify the ARN you configured earlier
Verify your new OTel Collector Layer and click Add
Navigate to the opentelemtry-lambda repository and access the layer-<PROGRAMMING_LANGUAGE>/
Copy the Amazon Resource Name (ARN) and set the configuration to match the AWS region and CPU architecture of your lambda function like the following example:
Navigate to Lambda -> Functions -> YOUR_FUNCTION -> Layers and click Add Layer
Navigate to Choose Layer and specify the ARN you configured earlier
Verify your new OTel Collector Layer and click Add
Navigate to Lambda -> Functions -> YOUR_FUNCTION -> Configuration > Environment Variables
Change your application’s entry point:
Import OpenTelemetry in the Code source editor of your function. Deploy and test your application to ensure OpenTelemetry logs should be visible.
Navigate to Lambda -> Functions -> YOUR_FUNCTION -> Configuration > Environment Variables
Initialize and save the following variables:
YOUR_MIDDLEWARE_URL
from the home page of your Middleware account. YOUR_ACCOUNT_KEY
is your personal Middleware password which can be injected programmatically or as a declaration. Deploy and Test your application to ensure logs from OpenTelemetry no longer appear. Check your Middleware account for traces by navigating to APM -> Services and finding the name of your function in the services list.