A custom runtime client for AWS Lamda written in Haskell.
Examples of how to use this client can be found in the examples directory.
- Stack
- Docker
- AWS CLI
- SAM CLI
- Run
make readyto pull the docker image used to build, install the stylish haskell code formatter, etc.
The default make target will compile and test the executables defined in
package.yaml. You can find the produced artifacts in the build directory.
make
If you see an error message similar to
Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY),
especially on your first build, try stack build --docker -j1.
Stack will build the defined executables in a docker container that is similar to the lambda environment the executable will run in. If you need to make changes to that environment (e.g. add a missing dependency that exists in the AWS Lambda AMI), update the Dockerfile and then rebuild the image. The base image is pulled from amazon, and requires that you login first.
$(aws ecr get-login --region us-west-2 --registry-ids 137112412989 --no-include-email)
docker build --tag=earnestresearch/earnestresearch/aws-lambda-haskell-platform:lts-12.24 .
The deploy make target will create the resources needed for the specified lambda.
NAME=api-gateway S3_BUCKET=<your s3 bucket name> make build package deploy
To add a new usage example:
- Create a new directory in the
examplesdirectory. The name of this directory gets used as the executable name so choose accordingly. - Add a
Main.hsto your new directory that implements your lambda function. - Add a SAM template that defines the resources needed by your lambda function
in your new directory. It should be named
template.yaml. UseCodeUri: '{{ZIP_FILE_PATH}}'for the code URI attribute. - Define a new executable in
package.yaml. Use the name of your directory as the executable name. - Add the directory name to the
EXAMPLESvariable in theMakefile. - Run
maketo verify there are no errors.