Skip to content

Running binary files inside AWS Lambda using AWS Layers

License

Notifications You must be signed in to change notification settings

DiegoVictor/regrex

Repository files navigation

Regrex

AppVeyor serverless eslint airbnb-style jest typescript coverage MIT License PRs Welcome
Run in Insomnia

Regrex is a API that executes grex (binary file) inside a lambda through an AWS Layer.

Infrastructure Diagram

Demo

Demo

Table of Contents

Requirements

Install

npm install

Or simple:

yarn

Was installed and configured the eslint and prettier to keep the code clean and patterned.

Configure

Access Grex repository page and download the linux distribution into dependencies/bin. Then zip the dependencies folder:

cd dependencies
zip -yr ../dependencies.zip .
cd ..

Or using 7zip:

cd dependencies
7z a ../dependencies.zip *
cd ..

For those that for any reason are not able to download the binary or compact your own package this repository is shipped with one package ready for use.

Then, deploy the API:

$ sls deploy

Usage

Refer to the Grex documentation, send the parameters and flags in the body of the request:

{
  "terms": [
    "sample",
    "example",
    "simple"
  ],
  "flags": ["x"]
}

Output:

(?x)
^
  (?:
    exa
    |
    s[ai]
  )
  mple
$

There are only a few flags not available:

  • -c, --colorize
  • -h, --help
  • -v, --version

Running the tests

Jest was the choice to test the app, to run:

$ yarn test

Or:

$ npm run test

Run the command in the root folder

Coverage report

You can see the coverage report inside tests/coverage. They are automatically created after the tests run.