Neatly Packaged Manuals

    lemna

    1.4.1 • Public • Published

    Lemna

    Version Build Status

    Quickly scaffold and deploy AWS Lambda handlers powered by Javascript or Typescript.

    Lemna will transpile, bundle and upload your code - no more tedious code deploying to Lambda.

    Dependencies will be bundled into your code using esbuild (https://esbuild.github.io/), so only required code is uploaded (dev dependencies will be ignored).

    Installation

    npm i lemna -g
    

    Scaffold new Lambda function

    lemna init
    

    This will setup a function folder with:

    • package.json
    • Typescript (+ tsconfig)
    • Lambda typings (@types/aws-lambda)
    • Basic Lambda handler (src/index.ts)
    • Lemna config (lemna.config.json)

    Deploying

    Create a .env file and place your AWS credentials in it. Then run:

    lemna deploy
    

    Use a custom path

    lemna deploy my-app/lemna.config.json
    

    Use glob patterns

    lemna deploy lambdas/**/lemna.config.json
    

    Use CommonJS module as config

    // lemna.config.js
    module.exports = {
      entryPoint: "path to .js file",
      function: {
        name: "lambda-function-name",
        runtime: "nodejs14.x",
      },
    };
    lemna deploy lemna.config.js
    

    Deploy multiple functions

    lemna deploy firstconfig.json secondconfig.json [...]
    

    Use in existing project

    • Create a lemna.config.json, including at least:
    {
      "entryPoint": "path to .js file",
      "function": {
        "name": "lambda-function-name",
        "runtime": "nodejs14.x"
      }
    }

    List functions

    lemna ls --page=0
    

    Print function details

    lemna show my-function
    

    Delete function

    lemna rm my-function
    

    Debugging/Tracing

    Run with LEMNA_LOG_LEVEL=error/warn/info/verbose/debug/silly

    LEMNA_LOG_LEVEL=silly lemna deploy
    

    Required AWS policies

    Required:

    • iam:PassRole
    • lambda:CreateFunction
    • lambda:UpdateFunctionCode
    • lambda:UpdateFunctionConfiguration
    • lambda:GetFunction
    • lambda:GetFunctionConfiguration

    Optional:

    • lambda:ListFunctions (for ls command)
    • lambda:DeleteFunction (for rm command)

    Install

    npm i lemna

    DownloadsWeekly Downloads

    127

    Version

    1.4.1

    License

    GPL-3.0

    Unpacked Size

    44.2 kB

    Total Files

    25

    Last publish

    Collaborators

    • dotvirus
    • marvin-j97