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.

Get started

By the end of this page you’ll have your own solution, a container running it, and a function that answers back. It takes about five minutes, or ten if Docker decides to download the internet first.

You need the .NET 10 SDK and Docker. You don’t need an AWS account yet. The container image ships with the Lambda runtime emulator, so your laptop can pretend to be AWS for a while.

  1. Install the template from NuGet.

    Terminal window
    dotnet new install CleanLambdaFunction.Template
  2. Create a solution. The name becomes your namespace, project names and folder, so pick something you’re happy to see a lot of.

    Terminal window
    dotnet new cleanlambdafunction --name Acme.Reviews --authorName "Your Name"
    cd Acme.Reviews
  3. Have a look around. Everything you need is already here.

    • Acme.Reviews.sln
    • Dockerfile
    • docker-compose.yml
    • Directorysrc/
      • DirectoryApplication/ the rules, queries and validation
        • …
      • DirectoryInfrastructure/ the database and repositories
        • …
      • DirectoryPresentation/ the Lambda handler
        • …
    • Directorytests/
      • DirectoryApplication.Tests.Unit/
        • …
      • DirectoryInfrastructure.Tests.Integration/
        • …
      • DirectoryPresentation.Tests.Integration/
        • …
  4. Build the image and start it with sample data. Docker Compose turns the sample data on for you.

    Terminal window
    docker compose up -d --build
  5. Invoke the function. The emulator listens on port 9000 and answers the same way Lambda does.

    Terminal window
    curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" \
    -d '{"query":"global","limit":2}'

    You get a page of movies back:

    {
    "Items": [
    { "Id": "30fca414-247a-779e-105a-d81aa2506f58", "Title": "Assimilated global infrastructure", "ReviewCount": 1, "AverageStars": 1 },
    { "Id": "c27d6600-79a6-9346-2595-a52b7f07dc3e", "Title": "Automated global alliance", "ReviewCount": 3, "AverageStars": 3.3 }
    ],
    "TotalCount": 2
    }

    Yes, the movies are named by a corporate buzzword generator. Assimilated global infrastructure only got one star. Critics can be harsh.

  6. Run the tests while you’re here.

    Terminal window
    dotnet test
  7. Tidy up when you’re done.

    Terminal window
    docker compose down