Skip to main content

Python

Using Layers

Integrating Serverless Debugger using AWS Lambda Layers is the recommended (and easier) way to get started with Serverless Debugger. Depending on whether or not you choose to use a custom runtime, you can integrate Serverless Debugger with no code changes at all or just by wrapping your handler function.

Step 1 - Deploy Your Function to AWS Lambda

Bundle all your Python module files and any additional required Python libraries, and then upload it to the AWS Lambda console using the Upload a.zip file option for the code entry type. Note that Thundra dependencies are not expected to be in the artifact to be uploaded, as they come with a layer that will be utilized at a later point

Step 2 - Add Thundra Layer

Next, add the Thundra layer by clicking on the Layers option in the Designer tab on your Lambda function console. Then select the “Add Layer” button and add the Thundra layer's ARN.

arn:aws:lambda:${region}:269863060030:layer:thundra-lambda-python-layer:${latest-version} 
note

Latest version of the Thundra Python layer Thundra Python Layer

info

Note that the region of the ARN is dynamic, so you need to change it accordingly to the region where you deploy your function. So let’s say that you deploy your Lambda function to the Oregon (us-west-2) region. The layer ARN will be arn:aws:lambda:us-west-2:269863060030:layer:thundra-lambda-python-layer:${layer-version}

Step 3: Configure Handler

Set the handler to thundra.handler.wrapper. Set the thundra_agent_lambda_handler environment variable value to your original handler (e.g., handler.handle ).

Step 4: Invoke Your Function

Clicking on the “Test” button, which is located on the top right side of the AWS console, will result in an invocation of your function (after you have configured test data per the specifications of your function)

After generating your first invocation, the “Next” button will appear in the Invocation Monitor bar. Simply click the button to see monitoring data from your invocation.

Without Layers

Step 1: Install Thundra’s python package

pip3 install thundra -t .

Step 2: Deploy Your Function to AWS Lambda.

Bundle all your Python module files and any additional required Python libraries, and then upload it to the AWS Lambda console using the “Upload a.zip file” option for the code entry type.

Step 3: Configure Handler

Set the handler to thundra.handler.wrapper. Set the thundra_agent_lambda_handler environment variable value to your handler.

Step 4: Invoke your function!

Clicking on the “Test” button, which is located on the top right side of the AWS console, will result in an invocation of your function (after you have configured test data per the specifications of your function).

Now you can try to invoke your Lambda function and see the details of your invocation in the Thundra console!