---
title: Environment variables for AWS Lambda
source: https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/env-variables-lambda
---

Environment variables are a way to store configuration and secrets outside of your code. The following tables display the mandatory variables and runtime specific variables that you can set to monitor your Lambda functions with New Relic.

## Mandatory environment variables

Regardless of your runtime, you must set the following environment variables to monitor your Lambda functions with New Relic:

| Environment variable            | Description                                                                                                               |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `NEW_RELIC_ACCOUNT_ID`          | Specifies your New Relic account ID                                                                                       |
| `NEW_RELIC_LAMBDA_HANDLER`      | Specifies the handler wrapper used to find your function's actual handler. For Go runtimes, this variable isn't required. |
| `NEW_RELIC_LICENSE_KEY`         | Specifies your New Relic ingest key, overriding Secrets Manager                                                           |
| `NEW_RELIC_APM_LAMBDA_MODE`     | Set to `true` to enable APM monitoring for your Lambda function                                                           |
| `NEW_RELIC_TRUSTED_ACCOUNT_KEY` | Specifies your New Relic account ID or parent ID, if it exists                                                            |

## Additional environment variables

Based on your runtime, you can set the following environment variables to further configure the New Relic Lambda monitoring:

### Node.js

| Environment variable                    | Default value | Options                                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------- | ------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEW_RELIC_USE_ESM`                     | `false`       | `true`, `false`                                    | **DEPRECATED**: This will be removed from future versions of the Node.js lambda layer.  Instead set your handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`                                                                                                                                                                                                                                                          |
| `NODE_OPTIONS`                          |               | `--experimental-loader newrelic/esm-loader.mjs`    | **Required**: If ESM is enabled, set this environment variable to use our ESM loader                                                                                                                                                                                                                                                                                                                                                              |
| `NEW_RELIC_AI_MONITORING_ENABLED`       | `false`       | `true`, `false`                                    | **Required for response streaming**: Set to `true` to enable the AI monitoring responses in New Relic UI.                                                                                                                                                                                                                                                                                                                                         |
| `NEW_RELIC_DISTRIBUTED_TRACING_ENABLED` | `true`        | `true`, `false`                                    | Generate traces by enabling Distributed Tracing                                                                                                                                                                                                                                                                                                                                                                                                   |
| `NEW_RELIC_NO_CONFIG_FILE`              | `false`       | `true`, `false`                                    | Use environment variables in Lambda by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_APP_NAME`                    |               |                                                    | Sets the application name used as the APM entity name in the New Relic UI when `NEW_RELIC_APM_LAMBDA_MODE` is `true`. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |
| `NEW_RELIC_LOG_ENABLED`                 | `false`       | `true`, `false`                                    | Enable agent logging by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                                    |
| `NEW_RELIC_LOG_LEVEL`                   | `info`        | `fatal`, `error`, `warn`, `info`, `debug`, `trace` | Set the agent log level                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `NEW_RELIC_LOG`                         | `stdout`      | `stdout`                                           | Set the agent log path to `stdout` for serverless mode                                                                                                                                                                                                                                                                                                                                                                                            |
| `NEW_RELIC_NATIVE_METRICS_ENABLED`      | `true`        | `true`, `false`                                    | Disable to reduce cold start duration by setting this to `false`, though it won't collect VM metrics                                                                                                                                                                                                                                                                                                                                              |

You can find more environment variables in our [Node.js configuration documentation](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/).

### Python

| Environment variable                    | Default value | Options                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------- | ------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEW_RELIC_DISTRIBUTED_TRACING_ENABLED` | `true`        | `true`, `false`                                 | Generate traces by enabling Distributed Tracing                                                                                                                                                                                                                                                                                                                                                                                                   |
| `NEW_RELIC_NO_CONFIG_FILE`              | `false`       | `true`, `false`                                 | Use environment variables in Lambda by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_APP_NAME`                    |               |                                                 | Sets the application name used as the APM entity name in the New Relic UI when `NEW_RELIC_APM_LAMBDA_MODE` is `true`. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |
| `NEW_RELIC_LOG`                         | `stderr`      | `stderr`                                        | Set the agent log path to `stderr` for serverless mode                                                                                                                                                                                                                                                                                                                                                                                            |
| `NEW_RELIC_LOG_LEVEL`                   | `info`        | `critical`, `error`, `warning`, `info`, `debug` | Set the agent log level                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `NEW_RELIC_SERVERLESS_MODE_ENABLED`     | `false`       | `true`, `false`                                 | Enable serverless mode by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                                  |
| `NEW_RELIC_PACKAGE_REPORTING_ENABLED`   | `true`        | `true`, `false`                                 | Improve cold start times by setting this to `false`                                                                                                                                                                                                                                                                                                                                                                                               |

You can find more environment variables in our [Python configuration documentation](https://docs.newrelic.com/docs/apm/agents/python-agent/configuration/python-agent-configuration/).

### Java

> #### ⚠️ IMPORTANT
>
> The New Java agent layer requires Java 17 or later.
> This is a seperate solution from the legacy [Java solution](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/instrument-your-own/#console).
> If you are using Serverless Monitoring for your application prior to April 10, 2026 or are on Java 8 or 11, then please continue use the legacy solution which is based on Open Tracing.

| Environment variable                    | Default value                   | Options                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------- | ------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AWS_LAMBDA_EXEC_WRAPPER`               |                                 | `/opt/newrelic-java-handler` | **Required**: Must be set to `/opt/newrelic-java-handler` when using the New Relic Java agent layer. This points AWS Lambda to the agent wrapper script bundled in the layer.                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_SERVERLESS_MODE_ENABLED`     | `true` (pre-set in layer)       | `true`, `false`              | Enables serverless mode. Automatically detected when `AWS_LAMBDA_FUNCTION_NAME` is present. Pre-configured to `true` in the layer.                                                                                                                                                                                                                                                                                                                |
| `NEW_RELIC_LOG_FILE_PATH`               | `/tmp/logs/` (pre-set in layer) | `/tmp/logs/`                 | By default sets up the Java agent log file to be in the absolute path `/tmp/logs/newrelic_agent.log`                                                                                                                                                                                                                                                                                                                                              |
| `NEW_RELIC_DISTRIBUTED_TRACING_ENABLED` | `true`                          | `true`, `false`              | Generate traces by enabling Distributed Tracing                                                                                                                                                                                                                                                                                                                                                                                                   |
| `NEW_RELIC_PRIMARY_APPLICATION_ID`      |                                 |                              | Set your New Relic account ID                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_DEBUG`                       | `false`                         | `true`, `false`              | Enable debug logging by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                                    |
| `NEW_RELIC_APP_NAME`                    |                                 |                              | Sets the application name used as the APM entity name in the New Relic UI when `NEW_RELIC_APM_LAMBDA_MODE` is `true`. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |

You can find more environment variables in our [Java agent configuration documentation](https://docs.newrelic.com/docs/apm/agents/java-agent/configuration/java-agent-configuration-config-file/) and [Java serverless monitoring](https://docs.newrelic.com/docs/apm/agents/java-agent/getting-started/java-agent-approaches-lambda).

### Go

| Environment variable                    | Default value | Options                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------- | ------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEW_RELIC_DISTRIBUTED_TRACING_ENABLED` | `true`        | `true`, `false`                      | Generate traces by enabling Distributed Tracing                                                                                                                                                                                                                                                                                                                                                                                                   |
| `NEW_RELIC_APP_NAME`                    |               |                                      | Sets the application name used as the APM entity name in the New Relic UI when `NEW_RELIC_APM_LAMBDA_MODE` is `true`. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |
| `NEW_RELIC_LOG`                         | `stdout`      | `stdout`                             | Set the agent log path to `stdout` for serverless mode                                                                                                                                                                                                                                                                                                                                                                                            |
| `NEW_RELIC_LOG_LEVEL`                   |               | `debug` for debug, or empty for info | Set the agent log level                                                                                                                                                                                                                                                                                                                                                                                                                           |

### Ruby

| Environment variable                    | Default value | Options         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------- | ------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEW_RELIC_DISTRIBUTED_TRACING_ENABLED` | `true`        | `true`, `false` | Generate traces by enabling Distributed Tracing                                                                                                                                                                                                                                                                                                                                                                                                   |
| `NEW_RELIC_APP_NAME`                    |               |                 | Sets the application name used as the APM entity name in the New Relic UI when `NEW_RELIC_APM_LAMBDA_MODE` is `true`. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |

### .NET

| Environment variable                    | Default value | Options                                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------- | ------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CORECLR_ENABLE_PROFILING`              | `0`           | `0`, `1`                                                | **Required**: Enable profiling by setting this to `1`                                                                                                                                                                                                                                                                                                                                                                                             |
| `CORECLR_PROFILER`                      |               | `{36032161-FFC0-4B61-B559-F6C5D41BAE5A}`                | **Required**: Set this to `{36032161-FFC0-4B61-B559-F6C5D41BAE5A}` to enable the .NET agent                                                                                                                                                                                                                                                                                                                                                       |
| `CORECLR_NEWRELIC_HOME`                 |               | `/opt/lib/newrelic-dotnet-agent`                        | **Required**: Set this to `/opt/lib/newrelic-dotnet-agent` to enable the .NET agent                                                                                                                                                                                                                                                                                                                                                               |
| `CORECLR_PROFILER_PATH`                 |               | `/opt/lib/newrelic-dotnet-agent/libNewRelicProfiler.so` | **Required**: Set this to `/opt/lib/newrelic-dotnet-agent/libNewRelicProfiler.so` to enable the .NET agent                                                                                                                                                                                                                                                                                                                                        |
| `NEW_RELIC_DISTRIBUTED_TRACING_ENABLED` | `true`        | `true`, `false`                                         | Generate traces by enabling Distributed Tracing                                                                                                                                                                                                                                                                                                                                                                                                   |
| `NEW_RELIC_APP_NAME`                    |               |                                                         | Sets the application name used as the APM entity name in the New Relic UI when `NEW_RELIC_APM_LAMBDA_MODE` is `true`. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |
| `NEW_RELIC_LOG_ENABLED`                 | `1`           | `1`, `0`                                                | Disable agent logging by setting this to `0`                                                                                                                                                                                                                                                                                                                                                                                                      |
| `NEW_RELIC_LOG_CONSOLE`                 | `0`           | `1`, `0`                                                | Set this to `1` to output logs to CloudWatch                                                                                                                                                                                                                                                                                                                                                                                                      |
| `NEW_RELIC_LOG_LEVEL`                   | `info`        | `info`, `debug`, `finest`                               | Set the agent log level                                                                                                                                                                                                                                                                                                                                                                                                                           |

You can find more environment variables in our [.NET configuration documentation](https://docs.newrelic.com/docs/apm/agents/net-agent/configuration/net-agent-configuration/) and [layerless instrumentation](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/enable-serverless-monitoring-aws-lambda-layerless/#dotnet) method.

### Lambda extension

| Environment variable                       | Default value                                        | Options                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------------------------------ | ---------------------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEW_RELIC_APP_NAME`                       |                                                      |                                                  | When `NEW_RELIC_APM_LAMBDA_MODE` is `true`, the extension uses this value as the APM entity name during the cold-start connect call. See [NEW_RELIC_APP_NAME for Lambda functions in APM mode](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/app-name-apm-lambda/) for details on entity grouping, multi-region reporting, cross-runtime behaviour, and shared naming with non-Lambda services. |
| `NEW_RELIC_LAMBDA_EXTENSION_ENABLED`       | `true`                                               | `true`, `false`                                  | Disable the extension by setting this to `false`                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `NEW_RELIC_LICENSE_KEY_SECRET`             | `NEW_RELIC_LICENSE_KEY`                              |                                                  | Set a custom secret name in AWS Secrets Manager                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `NEW_RELIC_DATA_COLLECTION_TIMEOUT`        | 10s                                                  |                                                  | Set the timeout duration for `Telemetry client error`                                                                                                                                                                                                                                                                                                                                                                                                            |
| `NEW_RELIC_EXTENSION_LOGS_ENABLED`         | `true`                                               | `true`, `false`                                  | Disable `[NR_EXT]` log lines by setting this to `false`                                                                                                                                                                                                                                                                                                                                                                                                          |
| `NEW_RELIC_EXTENSION_LOG_LEVEL`            | `INFO`                                               | `INFO`, `DEBUG`, `TRACE`, `ERROR`, `WARN`, `ALL` | Set the log level for  `NR_EXT` log lines                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS`   | `false`                                              | `true`, `false`                                  | Send function logs by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS`  | `false`                                              | `true`, `false`                                  | Send extension logs by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `NEW_RELIC_EXTENSION_SEND_PLATFORM_LOGS`   | `false`                                              | `true`, `false`                                  | Send platform logs by setting this to `true`                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_EXTENSION_SEND_LOGS`            |                                                      | `platform`, `extension`, `function`, `all`       | Determines which logs to send. Set to `all` or `function`, `extension`, and `platform` logs, or use a comma-separated list (for example: `platform,extension`). This variable takes precedence over individual log type variables.                                                                                                                                                                                                                               |
| `NEW_RELIC_LOG_ENDPOINT`                   | `https://log-api.newrelic.com/log/v1`                |                                                  | Set the logs endpoint. Select the URL as per your region: US region (default):https&#x3A;//log-api.newrelic.com/log/v1 EU region:https&#x3A;//log-api.eu.newrelic.com/log/v1 JP region:https&#x3A;//log-api.jp.nr-data.net/log/v1                                                                                                                                                                                                                                |
| `NEW_RELIC_TELEMETRY_ENDPOINT`             | `https://cloud-collector.newrelic.com/aws/lambda/v1` |                                                  | Set the telemetry endpoint. Select the URL as per your region: US region (default):https&#x3A;//cloud-collector.newrelic.com/aws/lambda/v1 EU data center:https&#x3A;//cloud-collector.eu01.nr-data.net/aws/lambda/v1 JP data center:https&#x3A;//cloud-collector.jp.nr-data.net/aws/lambda/v1                                                                                                                                                                   |
| `NEW_RELIC_IGNORE_EXTENSION_CHECKS`        |                                                      |                                                  | **DEPRECATED** Bypass checks by supplying them as comma-separated values within a string. Use `handler`, `agent`, `sanity`, `vendor`, or `all` string values                                                                                                                                                                                                                                                                                                     |
| `NEW_RELIC_LICENSE_KEY_SECRET`             |                                                      |                                                  | Specify the **name** or **ARN** of the secret from AWS Secrets Manager that contains your New Relic license key.  **Notes:** This is only used if \`NEW_RELIC_LICENSE_KEY\` is not set. The secret must be in the same AWS region as your Lambda function. Your Lambda function's execution role needs the \`secretsmanager:GetSecretValue\` permission for this secret.                                                                                         |
| `NEW_RELIC_LICENSE_KEY_SSM_PARAMETER_NAME` |                                                      |                                                  | Specify the **name** or **ARN** of the parameter from the AWS Systems Manager Parameter Store that contains your New Relic license key.  **Notes:** This is only used if \`NEW_RELIC_LICENSE_KEY\` is not set. The SSM parameter must be in the same AWS region as your Lambda function. Your Lambda function's execution role needs the \`ssm:GetParameter\` permission for this parameter.                                                                     |
| `NEW_RELIC_CLOUD_AWS_ACCOUNT_ID`           |                                                      |                                                  | To help New Relic correctly map and display relationships between your monitored entities, provide the AWS Account ID where your monitored resources, such as databases and Lambda functions, reside.                                                                                                                                                                                                                                                            |
| `NEW_RELIC_LAMBDA_EXTENSION_PROXY`         |                                                      |                                                  | Configures a proxy for the extension's outbound traffic and doesn't affect Lambda function traffic.  Supports: http&#x3A;//, https&#x3A;//, and socks5:// schemes Authentication: Supports user:pass (masked in logs) Fallback: Uses HTTPS_PROXY or HTTP_PROXY if unset > #### 💡 NOTE > > Localhost traffic is never proxied.                                                                                                                                   |

See more environment variables for the New Relic extension in our [documentation](https://github.com/newrelic/newrelic-lambda-extension/blob/cf86fb53f0bd816e1d09d07f7b5c5ab4841010a0/config/config.go#L41-L55).

## Next steps

[Install and configure Lambda monitoring](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/configure-serverless-aws-monitoring)

Get started with instrumentation and configuration for your Lambda functions

[Data and UI](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/instrument-your-own)

Learn how to use New Relic to monitor your AWS Lambda functions
