Luambda
Lua runtime for AWS Lambda
Install / Use
/learn @Sleitnick/LuambdaREADME

Luambda
Lua runtime for AWS Lambda.
Luambda is a Lambda Layer that allows developers to write Lambdas using Lua. To get started, read through the rest of this readme.
Create Layer
Option 1 - From the latest release:
- Download
luambda.zipfrom the latest release - Go to the Create Layer page on the AWS console
- Name the layer
Luambda - Click the Upload button and select the
luambda.zipfile from the unzipped release - In the Runtimes dropdown, select "Custom runtime"
- Under license, write MIT
- Click the Create button
Option 2 - From latest release & use CloudFormation:
- Download
luambda.zipfrom the latest release - Upload the
luambda.zipfile to S3 - Use the
luambda.yamlCF template to create the new stack
Option 3 - For a full custom build, execute the following commands:
# Clone repo
$ git clone https://github.com/Sleitnick/Luambda
$ cd Luambda
# Executable permissions
$ chmod +x build.sh compile.sh
# Package and upload to S3
$ ./build.sh
$ aws s3 cp dist/luambda.zip s3://<upload_bucket>/<optional_path>/luambda.zip
# Create Lambda Layer
$ aws cloudformation create-stack --stack-name LuambdaLayer --template-body file://aws/luambda.yaml --paramters ParameterKey=S3Bucket,ParameterValue=<s3_bucket> ParameterKey=S3Key,ParameterValue=<s3_key>
Warning for Windows users using option 3: The zip file created from the build.sh script may not work properly on Windows, because it will strip the permissions from the files, which will lead to errors when attempting to execute the lambda.
Use Layer
For your Lambda configuration, add Luambda as a layer.
Setup
The Handler property of your lambda follows the syntax of [script_name].[function_name]. The script should return a table that contains that function. For instance, if the handler was set as test.handler, then the code would look like this:
-- test.lua
local test = {}
function test.handler(event)
return {
Ok = "All good";
}
end
return test
Different Lua Versions
By default, Luambda uses LuaJIT, a JIT compiler for Lua. To use a different version, drop in the binaries under /runtime and then change the bootstrap file to point to the different binary.
For instance, you might change /opt/runtime/luajit in the bootstrap file to /opt/runtime/lua51.
Third-Party
The following third-party dependencies are used:
