Amazon Web Services Lambda


To use Sentry with AWS Lambda, you have to install raven as an external dependency. This involves creating a Deployment package and uploading it to AWS.

To install raven into your current project directory:

pip install raven -t /path/to/project-dir


Create a LambdaClient instance and wrap your lambda handler with the capture_exceptions decorator:

from raven.contrib.awslambda import LambdaClient

client = LambdaClient()

def handler(event, context):
    raise Exception('I will be sent to sentry!')

By default this will report unhandled exceptions and errors to Sentry.

The LambdaClient accepts the same arguments as the regular Client, see Configuring the Client.

The integration was inspired by raven python lambda, another implementation that also integrates with Serverless Framework and has SQS transport support.

In this guide