Datadog Serverless CLI
New announcements from Dash: Incident Management, Continuous Profiler, and more! New announcements from Dash!

Datadog Serverless CLI

This feature is in open beta. Let us know of any questions or issues by filing an issue in our repo.

You can use the CLI to instrument your AWS Lambda functions with Datadog.

Before you begin

Make your AWS credentials AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY available in your environment using the following cmd, or use any of the authentication methods supported by the AWS JS sdk.


Download the Datadog CI.


Configuration is done using a JSON file. Specify the datadog-ci.json using the --config argument, and this configuration file structure:

    "lambda": {
        "layerVersion": 10,
        "functions": ["arn:aws:lambda:us-east-1:000000000000:function:autoinstrument"],
        "region": "us-east-1",
        "tracing": true,
        "mergeXrayTraces": true,
        "forwarder": "arn:aws:lambda:us-east-1:000000000000:function:datadog-forwarder"


Use instrument to apply Datadog instrumentation to a Lambda.

The CLI accepts the --function (or shorthand -f) argument to specify which function to instrument. This should be a function ARN.

datadog-ci lambda instrument --function arn:aws:lambda:us-east-1:000000000000:function:autoinstrument --layerVersion 10
# Can also use shorthand formats
datadog-ci lambda instrument -f autoinstrument -f another-func -r us-east-1 -v 10
# Dry run of all update commands
datadog-ci lambda instrument -f autoinstrument -r us-east-1 -v 10 --dry

All arguments:

–function-fSpecificy a function to instrument
–region-rDefault region to use, when region isn’t specified in function ARN
–layerVersion-vVersion of the Datadog layer to apply. This varies between runtimes. To see the latest layer version check the JS or python datadog-lambda-layer repo release notes.
–tracingWhether to enable dd-trace tracing on your Lambda.true
–mergeXrayTracesWhether to join dd-trace traces to AWS X-Ray traces. Useful for tracing API Gateway spans.false
–flushMetricsToLogsWhether to send metrics asynchronously to Datadog via our Forwardertrue
–forwarderThe ARN of the datadog forwarder to attach this functions LogGroup to.
–dry-dPreview changes running command would apply.false