---
title: Instrument AWS Lambda applications
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Serverless > Serverless Monitoring for AWS Lambda > Instrument AWS
  Lambda applications
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Instrument AWS Lambda applications

## Overview{% #overview %}

Instrument your AWS Lambda applications with a Datadog Lambda Extension to collect traces, enhanced metrics, and custom metrics. The Datadog Lambda Extension is analogous to using the Datadog Agent and Datadog SDKs for host-based infrastructure and applications.

{% image
   source="https://docs.dd-static.net/images/serverless/serverless_tracing_installation_instructions.916e542d516b6e0e19d5f1dcf45dc027.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/serverless/serverless_tracing_installation_instructions.916e542d516b6e0e19d5f1dcf45dc027.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A diagram that shows how Datadog receives telemetry from your instrumented AWS Lambda application. Your Lambda application, instrumented with a Datadog Lambda Library, sends logs, traces, enhanced metrics, and custom metrics to the Datadog Lambda Extension, which then pushes this data to Datadog." /%}

## Quick start{% #quick-start %}

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com



{% alert level="danger" %}
This feature is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md) ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}


{% /callout %}

To get started, [sign up for a Datadog account](https://app.datadoghq.com/signup/) if you don't already have one. Then, follow the [in-app installation flow in Fleet Automation](https://app.datadoghq.com/fleet/install-agent/latest?platform=lambda) for AWS Lambda to instrument your Lambda functions. This quick-start configuration enables your functions to send real-time metrics, logs, and traces to Datadog.

A sample application is [available on GitHub](https://github.com/DataDog/serverless-sample-app) with instructions on how to deploy with multiple runtimes and infrastructure-as-code tools.

The quick start process configures your Lambda functions on the fly. To instrument Lambda functions permanently, see the sections below for agentic onboarding or manual instrumentation.

## Set up with agentic onboarding{% #set-up-with-agentic-onboarding %}

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com



{% alert level="danger" %}
This feature is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md) ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}


{% /callout %}

Use agentic onboarding to set up monitoring for your Lambda functions with AI assistance. Agentic onboarding detects your project's frameworks, applies the required configuration in place, and verifies that data is flowing. Two complementary paths use the same Datadog account:

- **Pup CLI**: Run `pup setup` from your terminal. It doesn't need your own coding assistant or AI model, so setup doesn't use your model tokens.
- **MCP server**: Set up from your IDE through a coding assistant such as Claude Code or Cursor.

{% tab title="Pup CLI" %}
Run `pup setup` in your project directory (requires Node.js 22+). It links your Datadog account, then instruments your Lambda function:

```shell
npx @datadog/pup setup --product serverless --serverless-compute-type=aws-lambda
```

Omit `--product` to run interactively, or add `--site` to target your Datadog site.
{% /tab %}

{% tab title="MCP server" %}
Use the Datadog MCP server's [`serverless_onboarding`](https://docs.datadoghq.com/agentic_onboarding.md?tab=serverlessmonitoring#mcp-server) tool to set up monitoring for your Lambda functions with AI assistance. After you connect, try a prompt like:

```
Help me monitor my AWS Lambda functions with Datadog.
```

{% /tab %}

## Manual Instrumentation{% #manual-instrumentation %}

- [python](https://docs.datadoghq.com/serverless/installation/python.md)
- [nodejs](https://docs.datadoghq.com/serverless/installation/nodejs.md)
- [ruby](https://docs.datadoghq.com/serverless/installation/ruby.md)
- [java](https://docs.datadoghq.com/serverless/installation/java.md)
- [go](https://docs.datadoghq.com/serverless/installation/go.md)
- [dotnet](https://docs.datadoghq.com/serverless/installation/dotnet.md)

## Memory requirements{% #memory-requirements %}

The Datadog Lambda Extension and the Datadog SDK run inside your function, so they add to the memory that every invocation uses. The overhead varies by runtime. For example, on Python, the extension and the SDK together use about 70 MB. Datadog does not change your function's memory size or timeout. A function with little headroom, such as one that uses the AWS default of 128 MB, can run out of memory or time out after you instrument it.

Datadog recommends a memory size of at least 256 MB for instrumented functions. If a function has less than 256 MB of memory, increase its memory size before you instrument it. After you instrument the function, check its memory use and duration.

The following installation tools show a warning when they instrument a function that has less than 256 MB of memory. The tools still instrument the function. To silence the warning after you confirm that a function has enough headroom, use the option for your tool:

| Tool                                                                                                                | Option to silence the warning                                                                                                                   | Default |
| ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| [Datadog CLI](https://docs.datadoghq.com/serverless/libraries_integrations/cli.md) (`datadog-ci lambda instrument`) | `--suppress-low-memory-warning` flag, or `"suppressLowMemoryWarning": true` in the `lambda` section of the `datadog-ci.json` configuration file | `false` |
| [Serverless Framework plugin](https://docs.datadoghq.com/serverless/libraries_integrations/plugin.md)               | `suppressLowMemoryWarning: true` setting under `custom.datadog`                                                                                 | `false` |
| [AWS CDK construct](https://docs.datadoghq.com/serverless/libraries_integrations/cdk.md) (`DatadogLambda`)          | `suppressLowMemoryWarning: true` property (`suppress_low_memory_warning=True` in Python)                                                        | `false` |
| [CloudFormation macro](https://docs.datadoghq.com/serverless/libraries_integrations/macro.md)                       | `suppressLowMemoryWarning: true` parameter, or the `DD_SUPPRESS_LOW_MEMORY_WARNING=true` environment variable on the macro function             | `false` |
| [Terraform module](https://github.com/DataDog/terraform-aws-lambda-datadog) (`terraform-aws-lambda-datadog`)        | `suppress_low_memory_warning = true` variable                                                                                                   | `false` |

The Terraform module reports the warning as a Terraform check warning. The CloudFormation macro cannot return warnings to the deployment, so it writes the warning to the macro function's CloudWatch logs.

If a function does not set a memory size, the AWS CDK construct, the CloudFormation macro, and the Terraform module use the AWS default of 128 MB and show the warning. The Serverless Framework uses a default memory size of 1,024 MB, so the Serverless Framework plugin does not show the warning for these functions.

[Remote instrumentation](https://docs.datadoghq.com/serverless/aws_lambda/remote_instrumentation.md) does not warn about or skip functions with less than 256 MB of memory. To leave these functions uninstrumented, don't select them.

## Advanced configurations{% #advanced-configurations %}

After you're done with instrumentation and you've set up telemetry collection, you can use [Configure Serverless Monitoring for AWS Lambda](https://docs.datadoghq.com/serverless/aws_lambda/configuration.md) to:

- connect your metrics, traces, and logs using tags
- collect telemetry from AWS resources such as API Gateway, AppSync, and Step Functions
- capture the request and response payloads for individual Lambda invocations
- link errors of your Lambda functions to your source code
- filter or scrub sensitive information from logs or traces

## Further Reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Configure Serverless Monitoring](https://docs.datadoghq.com/serverless/configuration.md)
- [AWS Lambda Integration](https://docs.datadoghq.com/integrations/amazon_lambda.md)
- [Configure AWS Lambda for Serverless Monitoring with Datadog](https://learn.datadoghq.com/courses/visibility-aws-lambda)
- [Datadog MCP Server: serverless_onboarding tool](https://docs.datadoghq.com/mcp_server/tools.md#serverless_onboarding)
