1.0.3 • Published 2 years ago

@kgrajan12/lambda-cli v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

lambda-cli

Especially this package is created for Edge@Lambda supported for Typescript

commands

  • lambda init
  • lambda run <event-file-name-without.json>
  • lambda build
  • lambda deploy
  • lambda invoke <event-file-name-without.json>

init

Example: lambda init my-edge-lambda This command will create a Edge@lambda project for you.

run

Example: lambda run home-page This command will run home-page.json event available in events folder you have to create this event file like below.

{
  "Records": [
    {
      "cf": {
        "config": {
          "distributionId": "EXAMPLE"
        },
        "request": {
          "method": "GET",
          "uri": "/image.jpg",
          "querystring": "",
          "headers": {
            "host": [
              {
                "key": "Host",
                "value": "d111111abcdef8.cloudfront.net"
              }
            ],
            "user-agent": [
              {
                "key": "User-Agent",
                "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
              }
            ],
            "accept": [
              {
                "key": "Accept",
                "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
              }
            ],
            "accept-encoding": [
              {
                "key": "Accept-Encoding",
                "value": "gzip"
              }
            ]
          },
          "origin": {
            "s3": {
              "authMethod": "none",
              "customHeaders": {},
              "domainName": "example-bucket.s3.amazonaws.com",
              "path": "",
              "region": "us-east-1"
            }
          }
        }
      }
    }
  ]
}

build

This command is used to build your code.

deploy

This command will deploy your code to AWS by using lambda.json you have to configure this

{
    src: "dist",
    events: "events",
    cloudFront: "EXAMPLECFID",
    lambdaName: option,
    behavior: "behaviour pattern",
    eventType: "origin-request",
    awsAccessKey: "awsAccessKey",
    awsSecretAccessKey: "awsSecretAccessKey",
}

invoke

Same like run command But This will invoke your lambda function in AWS by using local json file lambda invoke home-page

lambda.json configrations

Keys available in lambda.json

  • events
  • src
  • lambdaName
  • awsRegion
  • awsAccessKey
  • awsSecretAccessKey
  • AwsSessionToken
  • cloudFront
  • behavior
  • eventType
  • invalidatePath
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago