In this section, we consume the Lambda layer for use with Node.JS Lambda Functions. This includes a reduced version of the AWS Distro for OpenTelemetry Collector (ADOT Collector), which runs as a Lambda extension.
Note: Lambda layers are a regionalized resource, meaning that they can only be used in the Region in which they are published. Make sure to use the layer in the same region as your Lambda functions.
Find the supported regions and ARN in the table below for the ARNs to consume.
|Supported Regions||Lambda layer ARN format||Contents|
Contains the ADOT Collector for Lambda v0.13.0
To enable the AWS Distro for OpenTelemetry in your Lambda function, you need to add and configure the layer, and then enable tracing.
- Open the Lambda function you intend to instrument in the AWS console.
- In the Layers in Designer section, choose Add a layer.
- Under specify an ARN, paste the layer ARN, and then choose Add.
- Add the environment variable
AWS_LAMBDA_EXEC_WRAPPERand set it to
- Enable active tracing for your AWS Lambda function.
- By default, the layer is configured to export traces to AWS X-Ray. Make sure your Lambda role has the required AWS X-Ray permissions. For more on AWS X-Ray permissions for AWS Lambda, see the AWS Lambda documentation.
To disable OpenTelemetry for your Lambda function, remove the Lambda layer,
remove the environment variable
AWS_LAMBDA_EXEC_WRAPPER, and disable active tracing, as explained in the section above.
By default, the ADOT Lambda layer uses the config.yaml, which exports telemetry data to AWS X-Ray. To customize the Collector config, see the main Lambda section for custom configuration instructions