This project builds a function to be run on AWS Lambda and automatically releases it as part of the CI/CD pipeline.
You need access to a private repository in order to be able to build the whole project. However you can use this as an example on how to use AWS Lambda with Haskell.
Build with
. .env
make
Run locally with
make run-local
and call the lambda with
curl -X POST http://localhost:9000/2015-03-31/functions/function/invocations -H 'Content-Type: application/json' -d '{"type":"SAVE", "payload": "<payload>"}'
The repository is configured to build a docker image containing the lambda, publish it to AWS ECR and call terraform cloud to update the lambda. The secrets that need to be configured are:
AWS_REGION: the aws region where the ecr residesAWS_ECR_IMAGE: the name of the ecrAWS_KEY_IDandAWS_SECRET_KEY: the aws credentialsTF_TOKEN: an api token generated on terraform cloudTF_WORKSPACE: the workspace on terraform cloud
aws lambda invoke --function-name <function> --cli-binary-format raw-in-base64-out --payload '{"type": "SAVE", "payload": "<payload>"}' out.json