aws-lambda-haskell-runtime-client: AWS Lambda Haskell Runtime Client

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/EarnestResearch/aws-lambda-haskell-runtime-client#readme


[Skip to Readme]

Properties

Versions 0.1.0.0
Change log ChangeLog.md
Dependencies aeson (>=1.4.2 && <1.5), aws-lambda-haskell-runtime-client, base (>=4.7 && <5), bytestring (>=0.10.8 && <0.11), http-client (>=0.5.14 && <0.6), http-types (>=0.12.3 && <0.13), lens (>=4.17.1 && <4.18), monad-logger (>=0.3.30 && <0.4), mtl (>=2.2.2 && <2.3), text (>=1.2.3 && <1.3), transformers (>=0.5.6 && <0.6), unordered-containers (>=0.2.10 && <0.3), wreq (>=0.5.3 && <0.6) [details]
License MIT
Copyright Earnest Research 2019
Author Louis Vera
Maintainer dcq-team@earnestresearch.com
Category AWS
Home page https://github.com/EarnestResearch/aws-lambda-haskell-runtime-client#readme
Bug tracker https://github.com/EarnestResearch/aws-lambda-haskell-runtime-client/issues
Source repo head: git clone https://github.com/EarnestResearch/aws-lambda-haskell-runtime-client
Uploaded by amarrella at 2019-07-02T13:58:10Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for aws-lambda-haskell-runtime-client-0.1.0.0

[back to package description]

Build Status

aws-lambda-haskell-runtime-client

A custom runtime client for AWS Lamda written in Haskell.

Examples of how to use this client can be found in the examples directory.

Prerequisites

  1. Stack
  2. Docker
  3. AWS CLI
  4. SAM CLI
  5. Run make ready to pull the docker image used to build, install the stylish haskell code formatter, etc.

Building

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

Out of Memory Error

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.

Making Changes to the Build Environment

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 .

Deploy

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

Adding an Example

To add a new usage example:

  1. Create a new directory in the examples directory. The name of this directory gets used as the executable name so choose accordingly.
  2. Add a Main.hs to your new directory that implements your lambda function.
  3. Add a SAM template that defines the resources needed by your lambda function in your new directory. It should be named template.yaml. Use CodeUri: '{{ZIP_FILE_PATH}}' for the code URI attribute.
  4. Define a new executable in package.yaml. Use the name of your directory as the executable name.
  5. Add the directory name to the EXAMPLES variable in the Makefile.
  6. Run make to verify there are no errors.