AWS Lambda Extensions are companion processes that augment your Lambda functions. They run within the Lambda execution environment, alongside your Lambda function code. The Datadog Extension is a lightweight version of the Datadog Agent built to run alongside your code with minimal performance overhead.
The Datadog Extension supports submitting custom metrics and logs synchronously while your AWS Lambda function executes. This means that you can submit some of your telemetry data without the Datadog Forwarder. Note: The Datadog Forwarder is still required to submit traces to Datadog.
The Datadog Extension currently supports Node.js and Python runtimes.
The Datadog Lambda Extension is distributed as its own Lambda Layer (separate from the Datadog Lambda Library).
Add the Lambda Layer for the Datadog Extension to your AWS Lambda function with the following ARN:
Replace the placeholder values in the ARN as follows:
<AWS_REGION>with the same AWS region as your Lambda Function, for example,
<VERSION_NUMBER>with the version of the Datadog Lambda Extension you would like to use, for example
7. You can identify the current version by viewing the newest image tags in the Amazon ECR repository.
Note: This Layer is separate from the Datadog Lambda Library. If you installed the Datadog Lambda Library as a Lambda Layer, your function should now have two Lambda Layers attached.
Reference the sample code to submit a custom metric.
If your function is deployed as a container image, you cannot add Lambda Layers to your function. Instead, you must directly install the Datadog Lambda Library and the Datadog Lambda Extension in your function’s image.
Then, add the Datadog Lambda Extension to your container image by adding the following to your Dockerfile:
COPY --from=public.ecr.aws/datadog/lambda-extension:<TAG> /opt/extensions/ /opt/extensions
<TAG> with either a specific version number (for example,
7) or with
latest. You can see a complete list of possible tags in the Amazon ECR repository.
To submit your AWS Lambda logs to Datadog using the extension, set the env variable
true in your function.
Additional helpful documentation, links, and articles: