Remotely debug Lambda functions with Visual Studio Code
Lambda provides a remote debugging feature through the Amazon Toolkit for Visual Studio Code
With remote debugging, you can:
-
Set breakpoints in your Lambda function code
-
Step through code execution in real-time
-
Inspect variables and state during runtime
-
Debug Lambda functions deployed to Amazon, including those in VPCs or with specific IAM permissions
Remote debugging is supported for the following runtimes:
-
Python (Amazon Linux 2023)
-
Java
-
JavaScript/Node.js (Amazon Linux 2023)
Note
Remote debugging is supported for both x86_64 and arm64 architectures.
Before you begin remote debugging, ensure you have the following:
-
A Lambda function deployed to your Amazon account
-
Amazon Toolkit for Visual Studio Code. See Setting up the Amazon Toolkit for Visual Studio Code for installation instructions.
-
The version of the Amazon Toolkit you have installed is 3.69.0 or later.
-
Amazon credentials configured in Amazon Toolkit for Visual Studio Code. For more information, see Authentication and access control.
Follow these steps to start a remote debugging session:
-
Open the Amazon Explorer in VS Code (in the left sidebar).
-
Expand the Lambda section to see your functions.
-
Right-click on the function you want to debug.
-
From the context menu, select Remotely invoke.
-
In the invoke window that opens, check the box for Enable debugging.
-
Click Invoke to start the remote debugging session.
Note
Lambda functions have a 250MB combined limit for function code and all attached layers. The remote debugging layer adds approximately 40MB to your function's size.
A remote debugging session ends when you:
-
Choose Remove Debug Setup from the Remote invoke configuration screen
-
Select the disconnect icon in the VS Code debugging controls..
-
Select the handler file in the VS Code editor.
Note
The debug layer is automatically removed after 60 seconds of inactivity following your last invoke.
For more information on using Lambda in VS Code, refer to Developing Lambda functions locally with VS Code.
For detailed instructions on troubleshooting, advanced use cases, and region availability,
see Remote debugging Lambda functions