Skip to content
This repository was archived by the owner on May 21, 2020. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Each example contains a README.md with an explanation about the solution and it'
| [`five-minute-serverless-backend`](five-minute-serverless-backend) <br/> Build a serverless web backend in 5 minutes | nodeJS |
| [`quines`](quines) <br/> A small collection of self-replicating functions | nodeJS and python2 |
| [`python-crud-google-spreadsheet`](python-crud-google-spreadsheet) <br/> Google Spreadsheet CRUD with functions | python3 |
| [`lambda-binaris-wrapper`](lambda-binaris-wrapper) <br/> Run AWS Lambda code directly on Binaris | nodeJS |
16 changes: 16 additions & 0 deletions lambda-binaris-wrapper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Lambda wrapper example

This example demonstrates how to deploy a Binaris function that will run Lambda code.

### Usage

```bash
$ npm install
$ bn deploy wrapped_lambda
$ bn invoke wrapped_lambda
"Hello serverless!"
```

If you have existing Lambda code you would like to use, simply replace the contents of `handler.js`.

> Note: If your Lambda code has a different entrypoint, remember to update the `binaris.yml`
9 changes: 9 additions & 0 deletions lambda-binaris-wrapper/binaris.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
functions:
wrapped_lambda:
file: function.js
entrypoint: handler
executionModel: concurrent
runtime: node8
env:
LAMBDA_FILE_PATH: 'handler.js'
LAMBDA_HANDLER: 'hello'
5 changes: 5 additions & 0 deletions lambda-binaris-wrapper/function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { wrapLambda } = require('./node_modules/lambda-binaris-wrapper/lib/index.js');

const { LAMBDA_FILE_PATH, LAMBDA_HANDLER } = process.env;

exports.handler = wrapLambda(LAMBDA_FILE_PATH, LAMBDA_HANDLER);
5 changes: 5 additions & 0 deletions lambda-binaris-wrapper/handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports.hello = async (event, context) => {
return 'Hello serverless!';
};
30 changes: 30 additions & 0 deletions lambda-binaris-wrapper/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "lambda-binaris-wrapper",
"version": "1.0.0",
"private": true,
"license": "MIT",
"description": "Invoke existing AWS Lambdas as Binaris functions",
"main": "function.js",
"repository": {
"type": "git",
"url": "git+https://github.com/binaris/functions-examples.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bugs": {
"url": "https://github.com/binaris/functions-examples/issues"
},
"homepage": "https://github.com/binaris/functions-examples/lambda-binaris-wrapper/README.md",
"author": "Ryland Goldstein",
"dependencies": {
"@binaris/lambda-binaris-wrapper": "^1.0.0-rc.1"
},
"keywords": [
"Binaris",
"Slack",
"FaaS",
"Pi",
"Command"
]
}