• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Environment variables for AWS 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:

Variable Name

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

NEW_RELIC_LICENSE_KEY

Specifies your New Relic ingest key, overriding Secrets Manager

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:

Environment variable

Default value

Options

Description

NEW_RELIC_USE_ESM

false

true, false

Required: Enable ESM functions that use async/await and not callbacks by setting this to true

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

Set the application name, though it is not used in the New Relic UI

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.

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

Set the application name, though it is not used in the New Relic UI

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 true

You can find more environment variables in our Python configuration documentation.

Environment variable

Default value

Options

Description

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 the agent log level by setting this to true

Environment variable

Default value

Options

Description

NEW_RELIC_DISTRIBUTED_TRACING_ENABLED

true

true, false

Generate traces by enabling Distributed Tracing

Environment variable

Default value

Options

Description

NEW_RELIC_DISTRIBUTED_TRACING_ENABLED

true

true, false

Generate traces by enabling Distributed Tracing

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

Set the application name, though it is not used in the New Relic UI

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 and layerless instrumentation method.

Environment variable

Default value

Options

Description

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

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_LOG_ENDPOINT

https://log-api.newrelic.com/log/v1

https://log-api.newrelic.com/log/v1, https://log-api.eu.newrelic.com/log/v1

Set the logs endpoint

NEW_RELIC_TELEMETRY_ENDPOINT

https://cloud-collector.newrelic.com/aws/lambda/v1

https://cloud-collector.newrelic.com/aws/lambda/v1, https://cloud-collector.eu01.nr-data.net/aws/lambda/v1

Set the telemetry endpoint

NEW_RELIC_IGNORE_EXTENSION_CHECKS

Bypass checks by supplying them as comma-separated values within a string. Use handler, agent, sanity, vendor, or all string values

See more environment variables for the New Relic extension in our documentation.

What's next

Install and configure Lambda monitoring

Get started with instrumentation and configuration for your Lambda functions

Data and UI

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

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.