AWS Lambda Container Image (Node)

Learn how to set up Sentry with a Container Image.

As an alternative setup method, you can add Sentry to your Container Image. To import Sentry's Layer Image, add the following to your Dockerfile:

COPY<VERSION> /opt/ /opt

Replace VERSION with a specific version number (for example, 28). You can see a complete list of available versions in Sentry's Amazon ECR repository.

Set the following environment variables in AWS:

  • Set NODE_OPTIONS to -r @sentry/aws-serverless/awslambda-auto
  • Set SENTRY_DSN to your Sentry's DSN
  • Set SENTRY_TRACES_SAMPLE_RATE to your preferred sampling rate for transactions

Alternatively, you can also set the environment variables in the Dockerfile:

ENV NODE_OPTIONS="-r @sentry/aws-serverless/awslambda-auto"

The values you set in AWS override the value in the Dockerfile if both are set.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").