# WAI Lambda - Haskell Webapps on AWS Lambda [![Hackage](https://img.shields.io/hackage/v/wai-lambda.svg)](https://hackage.haskell.org/package/wai-lambda) This Haskell library turns any [wai] webapp ([spock], [servant], etc) into a handler for AWS [Lambda][lambda] and [API Gateway][api-gateway] requests. ``` haskell {-# LANGUAGE OverloadedStrings #-} import Network.Wai import Network.HTTP.Types import Network.Wai.Handler.Lambda (run) app :: Application app _ respond = do putStrLn "I've done some IO here" respond $ responseLBS status200 [("Content-Type", "text/plain")] "Hello, Web!" main :: IO () main = run app ``` This doesn't require any particular Lambda environment. By following the instructions in the [build](#build) section the resulting `zip` file uploaded to AWS Lambda is typically smaller than 1MB. For basic webapps the request handling duration (as reported by AWS) is between 1 and 5 milliseconds. * [**Install**](#install) with either Cabal, stack or Nix. * [**Build for AWS**](#build) with Nix and fully static executables. * [**Deploy to AWS**](#deploy) with Nix and Terraform. ## Install ### Cabal Installing with Cabal: ``` shell $ cabal install wai-lambda ``` ### Stack If you use stack and `wai-lambda` is not included in your snapshot, add it to the `extra-deps`: ``` yaml extra-deps: - wai-lambda-0.1.0.0 ``` or from GitHub: ``` yaml packages: - ... - location: git: https://github.com/deckgo/wai-lambda.git commit: