https://github.com/encalmo/scala-aws-lambda-local-host
Local emulator of the AWS Lambda host environment. Starts local HTTP server implementing lambda runtime API. Provides browser-based HTML interface to send input to lambda and to read output.
https://github.com/encalmo/scala-aws-lambda-local-host
aws-lambda scala scala3 testing
Last synced: 2 months ago
JSON representation
Local emulator of the AWS Lambda host environment. Starts local HTTP server implementing lambda runtime API. Provides browser-based HTML interface to send input to lambda and to read output.
- Host: GitHub
- URL: https://github.com/encalmo/scala-aws-lambda-local-host
- Owner: encalmo
- License: mit
- Created: 2025-02-27T13:39:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-26T08:19:52.000Z (over 1 year ago)
- Last Synced: 2025-06-06T02:02:38.914Z (about 1 year ago)
- Topics: aws-lambda, scala, scala3, testing
- Language: Scala
- Homepage: https://encalmo.github.io/scala-aws-lambda-local-host/
- Size: 360 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
  
# scala-aws-lambda-local-host
Local emulator of the AWS Lambda host environment.
Starts local HTTP server implementing https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html.
Provides browser-based HTML interface to send input to lambda and to read output.


## Table of contents
- [Dependencies](#dependencies)
- [Usage](#usage)
- [Options](#options)
- [Example](#example)
- [Project content](#project-content)
## Dependencies
- [Scala](https://www.scala-lang.org) >= 3.3.5
- com.lihaoyi [**os-lib** 0.11.4](https://github.com/com-lihaoyi/os-lib)
## Usage
Use with SBT
libraryDependencies += "org.encalmo" %% "scala-aws-lambda-local-host" % "0.9.1"
or with SCALA-CLI
//> using dep org.encalmo::scala-aws-lambda-local-host:0.9.1
## Options
|Option|Description|
|---|---|
|--mode|User interface choice. Either `commandline` (default) or `browser`|
|--lambda-name|Name of the lambda passed to AWS_LAMBDA_FUNCTION_NAME environment variable|
|--lambda-script|Command line to run custom lambda runtime|
## Example
Run AWS Lambda host locally (works with any lambda runtime):
```
scala run --main-class org.encalmo.lambda.host.LocalLambdaHost \
--quiet --suppress-directives-in-multiple-files-warning \
--suppress-outdated-dependency-warning . \
-- \
--mode=browser
```
Run AWS Lambda host locally with some Scala lambda:
```
scala run --main-class org.encalmo.lambda.host.LocalLambdaHost \
--quiet --suppress-directives-in-multiple-files-warning \
--suppress-outdated-dependency-warning . \
-- \
--mode=browser \
--lambda-script="scala run --quiet --suppress-directives-in-multiple-files-warning --suppress-outdated-dependency-warning --dependency=org.encalmo::scala-aws-lambda-runtime:0.9.1 --main-class org.encalmo.lambda.TestEchoLambda" \
--lambda-name=Echo
```
Run an example TestEchoLambda:
```
/scripts/runTestEchoLambdaHostInBrowser.sh
```
## Project content
```
├── .github
│ └── workflows
│ ├── pages.yaml
│ ├── release.yaml
│ └── test.yaml
│
├── .gitignore
├── .scalafmt.conf
├── LICENSE
├── LocalLambdaHost.scala
├── project.scala
├── README.md
├── screenshot.png
├── screenshot2.jpg
└── scripts
├── runTestEchoLambdaHostInBrowser.sh
└── testEchoLambda.scala
```