Skip to content
Clean Lambda Function
Lean Mean Clean Apps

Five templates, one search box. Everything in the docs is in here, including the bits we hoped you'd skim.

Try one of these

Results say which template they came from, so you won't end up reading about Lambda when you wanted GraphQL. Again.

Run it locally

The image is built on the AWS Lambda .NET base image, which includes the Lambda runtime interface emulator. Your function runs locally exactly the way Lambda runs it, just with fewer invoices.

Terminal window
docker compose up -d --build

Compose builds the run stage, publishes port 9000 and turns on sample data. Shut it down with docker compose down.

Then invoke it from another terminal:

Terminal window
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"limit":5}'

The image runs GetMovies by default. The same handler also has GetAuthors and GetReviews. Pass the function’s full handler name to docker run to start a different one.

Terminal window
docker run --rm -p 9000:8080 -e Database__SeedSampleData=true acme-reviews:local \
"Presentation::Acme.Reviews.Presentation.LambdaFunction.Handler::GetReviews"
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" \
-d '{"movieId":"e159975e-4e6a-1ffd-713e-1eb9d8d4a593","limit":2}'

The sample data uses a fixed seed, so that movie id is the same on every machine. See the function reference for every request and response.

Terminal window
dotnet test

Each test builds its own in-memory SQLite database from the migrations and the same fixed seed. No test can change what another one sees, and nothing touches the database file in /tmp.

The Dockerfile has a stage for each job, so you can build only what you need.

Stage What it does
build Restores and builds the solution
test Runs every test with coverage
coverage Exports the coverage report to your machine
publish Publishes the Presentation project
run The Lambda image you deploy
Terminal window
docker build . --target coverage --output type=local,dest=out
Terminal window
docker build . --target run --tag acme-reviews:latest \
--build-arg VERSION_PREFIX=1.2.3 --build-arg VERSION_SUFFIX=beta