Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/isaacvando/roc-aws-lambda


https://github.com/isaacvando/roc-aws-lambda

aws aws-lambda lambda roc-lang rust

Last synced: 25 days ago
JSON representation

Awesome Lists containing this project

README

        

# roc-aws-lambda

A [custom runtime](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html) for AWS Lambda written in Roc using [basic-cli](https://github.com/roc-lang/basic-cli).

## Usage

To write a Lambda, update `Handler.roc`:

```roc
handle! : List U8 => Result Str _
handle! = \bytes ->
# Your logic here
```

The runtime code is in `bootstrap.roc` which is compiled to a binary called `bootstrap` that Lambda runs to initialize the runtime. Once the runtime receives a request from Lambda, it calls `Handler.handle` to process the request.

To build a function, use the included script:

```bash
$ ./build.sh
```

Then deploy the Lambda to AWS with the deployment script:

```bash
$ ./deploy.sh your_function_name arn:aws:iam::{your_account_id}:role/{your_role_name}
```

or by manually uploading the `bootstrap.zip` generated by `build.sh` to the AWS Console.

## Local Testing

You can test your functions locally with `local.roc`. It will read input from stdin and pass it to the function:

```bash
echo some input | roc local.roc
Hello, World!
```

## Contributing

PRs welcome!