stlv dev: run Lambda functions locally
stlv dev is like stlv deploy, but your Lambda handler code runs on your machine while the rest of your infrastructure stays in AWS.
Why you'd use it
- No redeploy on every code change
- See
print()output immediately - Exceptions show up in your terminal (and in the Lambda response)
- Easy to attach a local debugger
How it works
When you run stlv dev, Stelvio deploys your app in dev mode:
- Your Lambdas get replaced with a small stub Lambda.
- The stub forwards each invocation over an AppSync Events channel.
- The
stlv devprocess runs a local dev server, executes your real handler, then sends the result back to AWS.
Your public entrypoint (API Gateway URL / Function URL) stays the same — you hit it like normal.
Using it
No changes to stlv_app.py are needed.
Start dev mode:
Now call your API like you normally would (e.g. https://...execute-api.../v1/). Edit your function code and refresh — the next request picks it up.
To stop the local server: Ctrl+C.
Warning
Stopping the dev server won't change the infrastructure in AWS. In particular, the replacement Lambda function that handles the dev mode ("stub Lambda") will remain deployed.
You need to re-deploy without dev mode using stlv deploy again to switch back to your real Lambda code being deployed to AWS.
Warning
stlv dev still deploys real AWS resources (so it needs AWS credentials and it can cost money). It will also create an AppSync API named stelvio in your account if it's not already present. The AppSync API is a purely usage-based cost model.
Limitations
Target Architecture
Stelvio's dev mode will execute your local Lambda functions natively, i.e. the Python interpreter is used on your workstation's operating system and CPU architecture, no matter your Lambda function definition. There is no emulator in place that would match the os/architecture on AWS with the one on your workstation.
Since your workstation is likely equipped with more RAM than your Lambda function, this also mean that you're less likely to run into memory limits on your workstation.
Request/Response Size limits
Since the Routing mechanism is handled through AppSync internally, your local Lambda functions cannot exceed AppSync's message size limit of 240kb.
AWS Lambda comes with higher limits for request/response size:
- 6 MB each for request and response (synchronous)
- 200 MB for each streamed response (synchronous)
- 1 MB (asynchronous)
- 1 MB for the total combined size of request line and header values
Future versions of Stelvio will allow for larger request/response sizes in dev mode.