lambda-dev-server
A lightweight development server for AWS Lambda, lambda-dev-server emulates the Lambda environment locally by creating events and contexts for any app handler. It processes requests, generates Lambda events, and returns parsed responses—ideal for development and debugging, with hot-reloading for rapid iteration. Not intended for production use. This has been tested with lambdas that use aws-lambda-powertools as well with lambdas that return in the shape of {"statusCode": 200, "body": "Hello World"}.
Table of Contents
Installation
To install lambda-dev-server, use pip:
pip install lambda-dev-server
Usage
# Given a Lambda handler named handler in app.py
lambda-dev-server app.handler
Debugging
You can configure your debugger in Visual Studio Code (VSCode) with the following launch.json configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Module",
"type": "debugpy",
"request": "launch",
"module": "lambda_dev_server",
"args": ["app.handler"]
}
]
}
1. Traditional Development Flow (Without lambda-dev-server)
This diagram illustrates the development flow when using sam start-api or manually invoking the Lambda handler. While sam start-api allows using tools like Postman or curl.
sequenceDiagram
participant User as User
participant API as API Gateway
participant SAM as AWS SAM/Local API
participant Lambda as AWS Lambda
participant IDE as IDE/Debugger
User->>SAM: Use `sam start-api` (Build App)
SAM->>API: Start Local API (API Gateway)
User->>API: Send Request (Postman or Curl)
API->>Lambda: Forward Request to Lambda Handler
Lambda->>Lambda: Process Event & Context
Lambda->>API: Return Processed Response
API->>User: Return Response to User
Note over SAM: Requires Build Step & Template.yaml Updates
Note over API, Lambda: No Hot Reloading, Debugger Not Attached
Note over User: Can Use Postman or Curl with `sam start-api`
Drawbacks:
- Manual event preparation: When calling the Lambda handler directly via
invoke, users must manually create events. - Requires
sam start-api: Usingsam start-apirequires building the application and maintaining atemplate.yamlfile. - No hot reloading: Code changes require restarting the local API, making iteration slower.
- No debugger attachment: Debugging during development is more complex.
2. Invoke/Direct Handler Call Flow (Without lambda-dev-server)
This flow demonstrates the manual process involved when invoking or calling the Lambda handler directly. Users must manually construct the event before sending it to the Lambda function.
sequenceDiagram
participant User as User
participant Lambda as AWS Lambda
participant IDE as IDE/Debugger
User->>User: Manually Construct Event
User->>Lambda: Invoke or Call Lambda Handler Directly
Lambda->>Lambda: Process Event & Context (Handler Logic)
Lambda->>User: Return Processed Response
User->>User: View Response
Note over User: Must Manually Create Event
Note over Lambda: No API Gateway or Automatic Event Simulation
Note over IDE: No Hot Reloading or Debugger Attach in this Flow
Drawbacks:
- Manual event construction: The user has to manually create the event, which is error-prone and cumbersome.
- No API Gateway: The flow lacks the built-in API Gateway to handle routing and automatic event creation.
- No hot reloading or debugger: Users cannot easily attach a debugger or take advantage of hot reloading in this flow.
3. Improved Flow with lambda-dev-server
This flow illustrates the seamless experience provided by lambda-dev-server. With no build steps, hot reloading, and easy event simulation, development becomes faster and easier.
sequenceDiagram
participant User as User
participant Server as Lambda Dev Server
participant Lambda as AWS Lambda Handler
participant IDE as IDE/Debugger
User->>Server: Run `lambda-dev-server` with Handler
Server->>Server: Start Web Server (Uvicorn/WSGI)
User->>Server: Send Request (Postman or Curl)
Server->>Server: Simulate Lambda Event & Context
Server->>Lambda: Call Lambda Handler with Event & Context
Lambda->>Lambda: Process Event & Context (Handler Logic)
Lambda->>Server: Return Response
Server->>User: Return HTTP Response
Note over Server: No Build Step Required
Note over Server: Hot Reloading on Code Changes
Note over IDE: Attachable Debugger
Note over User: Use Postman or Curl to Call API
Benefits:
- No build step: Directly run the Lambda handler through a web server, bypassing the need to build the application.
- Hot-reloading: Changes to the code are reflected immediately, speeding up the development process.
- Debugger attachment: Easily attach a debugger to the running server for troubleshooting.
- Automatic event simulation: The server handles event creation and Lambda context simulation, saving time.
- Seamless interaction: Use tools like Postman or curl to test the handler just like a regular REST API.
Conclusion
lambda-dev-server significantly improves the AWS Lambda development experience by allowing you to:
- Avoid the need for build steps and maintaining
template.yaml. - Use Postman or curl just like in regular REST API development.
- Enjoy hot reloading and easy debugging for rapid iteration.
License
lambda-dev-server is distributed under the terms of the MIT license.
Metadata
Release files for lambda-dev-server 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lambda_dev_server-0.0.8.tar.gz | 14.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lambda_dev_server-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.1 kB
Release files / lambda_dev_server-0.0.8.tar.gz
| Download URL | lambda_dev_server-0.0.8.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0928776e3810a16d2e02c7ae8a7fd310a7ea935e37d12cb086ed1d4474058b13
|
|
BLAKE2b-256 checksum How to use checksums |
cc569bf5a3e0da38d0110beb44e4d1abbec5db7cc37830433cf1084c605e8fa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2025.
Transparency logRelease files / lambda_dev_server-0.0.8-py3-none-any.whl
| Download URL | lambda_dev_server-0.0.8-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c242000035b722604eaa0b22590918e8b13519069499ecb5ae296ca93b867568
|
|
BLAKE2b-256 checksum How to use checksums |
658512877ada61bc39920c6eea6b06034e2e0a2b84f5b6dfa126f45a95f17a4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2025.
Transparency logSecurity for lambda-dev-server 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for lambda_dev_server-0.0.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.