Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sleitnick/luambda
Lua runtime for AWS Lambda
https://github.com/sleitnick/luambda
aws lambda lua luajit luambda
Last synced: 13 days ago
JSON representation
Lua runtime for AWS Lambda
- Host: GitHub
- URL: https://github.com/sleitnick/luambda
- Owner: Sleitnick
- License: mit
- Created: 2020-06-29T15:22:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-29T21:13:37.000Z (over 4 years ago)
- Last Synced: 2024-10-24T22:18:08.999Z (2 months ago)
- Topics: aws, lambda, lua, luajit, luambda
- Language: Lua
- Homepage:
- Size: 299 KB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
![Lint](https://github.com/Sleitnick/Luambda/workflows/Lint/badge.svg)
![Release](https://github.com/Sleitnick/Luambda/workflows/Release/badge.svg)![logo](imgs/logo_128.png)
# Luambda
Lua runtime for AWS Lambda.
Luambda is a [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) 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:
1. Download [`luambda.zip`](https://github.com/Sleitnick/Luambda/releases/latest/download/luambda.zip) from the latest release
1. Go to the [Create Layer](https://console.aws.amazon.com/lambda/home?region=us-east-1#/create/layer) page on the AWS console
1. Name the layer `Luambda`
1. Click the Upload button and select the `luambda.zip` file from the unzipped release
1. In the Runtimes dropdown, select "Custom runtime"
1. Under license, write MIT
1. Click the Create button### Option 2 - From latest release & use CloudFormation:
1. Download [`luambda.zip`](https://github.com/Sleitnick/Luambda/releases/latest/download/luambda.zip) from the latest release
1. Upload the `luambda.zip` file to S3
1. Use the [`luambda.yaml`](https://github.com/Sleitnick/Luambda/blob/master/aws/luambda.yaml) CF template to create the new stack### Option 3 - For a full custom build, execute the following commands:
```sh
# 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:////luambda.zip# Create Lambda Layer
$ aws cloudformation create-stack --stack-name LuambdaLayer --template-body file://aws/luambda.yaml --paramters ParameterKey=S3Bucket,ParameterValue= ParameterKey=S3Key,ParameterValue=
```**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:
```lua
-- test.lualocal test = {}
function test.handler(event)
return {
Ok = "All good";
}
endreturn test
```## Different Lua Versions
By default, Luambda uses [LuaJIT](https://luajit.org/), a JIT compiler for [Lua](https://www.lua.org/). 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:
- [LuaJIT](https://luajit.org/) [MIT license]
- [json.lua](https://github.com/rxi/json.lua) [MIT license]