Racket implementation of the lambda runtime API. It uses a Minimal Racket distribution.
The purpose of this repository is to understand how to implement a custom AWS Lambda runtime.
If you just want to run your racket code in Lambda, there is a publickly available layer you can use with arn arn:aws:lambda:ap-northeast-2:389941452291:layer:lambda-racket-runtime:21.
Please be noted that the layer's version would be changed and it hopefully will be updated as a new version is available.
It does not support error-handling at the moment.
To build the runtime, you need a Docker environment. You can use free tier eligible AWS EC2 instance for this.
$ git clone https://github.com/kpiljoong/lambda-racket-runtime.git
$ cd lambda-racket-runtime
$ make build
This will make a 'lambda-racket-runtime.zip' file for you.
$ make archive
Publish a layer containing the runtime.
$ aws lambda publish-layer-version --layer-name lambda-racket-runtime --zip-file fileb://lambda-racket-runtime.zip
The output will show you the LayerVersionArn.
- Make an archive of a test file
$ make demo-archive
- Create a test Lambda function (you need a IAM role for the function)
$ aws lambda create-function --function-name racket-demo --role LAMBDA_ROLE_ARN --runtime provided --timeout 15 --memory-size 128 --handler demo:main --zip-file fileb://racket-demo.zip
- Add the layer to the function
$ aws lambda update-function-configuration --function-name racket-demo --layers LAYER_VERSION_ARN
- Invoke the function
$ aws lambda invoke --function-name racket-demo --payload '' output.json
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}
$ cat output.json
Hello AWS! Happy coding!!