---
title: "AWS Lambda Primer"
url: https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda/
---

# AWS Lambda Primer

Lambda functions can be written in numerous programming languages (JavaScript, Python, Ruby, Java, Go, ...). Sentry is currently supporting automatic instrumentation of Lambda functions written in [JavaScript](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/) and [Python](https://docs.sentry.io/platforms/python/integrations/aws-lambda/).

See the [Sentry Documentation](https://docs.sentry.io/product/integrations/cloud-monitoring/) on how to set up serverless instrumentation.

## [A short primer into AWS Lambda functions, and layers.](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#a-short-primer-into-aws-lambda-functions-and-layers)

A Lambda function is a zipped directory that contains everything the Lambda language runtime needs to execute the code in it. You need to have your function code as well as all dependencies in your Lambda function directory. Lambda functions are invoked by an event (ex: visiting an URL) and are billed by the milliseconds the function took to complete.

AWS Lambda layers can be attached to functions. Layers are zipped directories as well and contain additional code used by your Lambda function. Layers are used for sharing code between functions or to add third-party functionality, like the Sentry SDK to your Lambda function.

## [Sentry AWS Lambda Integration](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#sentry-aws-lambda-integration)

With the AWS Lambda Integrations users can add Sentry functionality to their Lambda function without changing the code of the Lambda function.

Sentry is providing a Lambda Layer including the JavaScript SDK (or Python SDK).

See the documentation to learn how customers can instrument their Lambda functions: <https://docs.sentry.io/product/integrations/cloud-monitoring/aws-lambda/>

## [Sentry Lambda Layer](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#sentry-lambda-layer)

Sentry is deploying one Lambda Layer for Node-based Lambda functions (`SentryNodeServerlessSDK`) and one Lambda Layer for Python-based Lambda functions (`SentryPythonServerlessSDK`). Those Lambda layers are distributed to various AWS regions to be close to the users.

Both these layers include the latest Sentry JavaScript SDK (or Python SDK).

### [Building of the Python Layer](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#building-of-the-python-layer)

The contents of the Layer directory for the Python layer are built during the "CI" workflow in GitHub actions. The steps necessary can be found [here](https://github.com/getsentry/sentry-python/blob/master/.github/workflows/ci.yml).

This will prepare the Lambda layer directory, compress everything and upload the resulting zip file as an artifact to GitHub.

### [Deployment of the Python Layer](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#deployment-of-the-python-layer)

The zip file prepared in the previous step will be deployed to AWS Lambda by [Craft](https://github.com/getsentry/craft).The configuration of craft for doing this can be found [here](https://github.com/getsentry/sentry-python/blob/master/.craft.yml).

To deploy a new version of the Lambda layer to AWS, you need to trigger a new release of the Python SDK.

### [Building of the JavaScript/Node Layer](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#building-of-the-javascriptnode-layer)

The contents of the Layer directory for the JavaScript/Node layer are built during the "Build & Test" workflow in GitHub actions. The steps necessary can be found [here](https://github.com/getsentry/sentry-javascript/blob/master/.github/workflows/build.yml).

This will prepare the Lambda layer directory, compress everything and upload the resulting zip file as an artifact to GitHub.

### [Deployment of the JavaScript/Node Layer](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#deployment-of-the-javascriptnode-layer)

The zip file prepared in the previous step will be deployed to AWS Lambda by [Craft](https://github.com/getsentry/craft). The configuration of craft for doing this can be found [here](https://github.com/getsentry/sentry-javascript/blob/master/.craft.yml).

To deploy a new version of the Lambda layer to AWS, you need to trigger a new release of the JavaScript SDK.

### [Development Environment](https://develop.sentry.dev/sdk/platform-specifics/serverless-sdks/aws-lambda.md#development-environment)

When working on the Sentry AWS Lambda layer, the workflow is that you have your example Lambda function in a dev account on AWS and then deploy your local layer and attach it to your example function. How to do this in Python is described in the [contribution guide](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md#contributing-to-sentry-aws-lambda-layer) of the Python SDK.
