Skip to content

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

bls20AWS/function-stencil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Welcome to function-stencil πŸ‘‹

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM definition and appropriate file structure.

Install

npm install function-stencil

Usage

function-stencil init

1. Choose the function runtime

? What runtime do you need? (Use arrow keys)
❯ nodejs16.x 
  nodejs14.x 
  python3.9 
  java11
  dotnet6

2. Provide a function name

Whats the function name? MyFunctionName

3. Choose a templating language snippet

? Choose one of the following templating languages for this runtime (Use arrow keys)
❯ sam 
  terraform 

4. Function code and file system is generated

MyFunctionName
 β”— function
 ┃ ┣ events
 ┃ ┃ β”— event.json
 ┃ ┣ app.js
 ┃ ┣ env.json
 ┃ ┣ harness.js
 ┃ β”— package.json

4. AWS SAM snippet is generated, drop this into the resource block of your SAM template.yaml

  MyFunctionName:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: MyFunctionName/function/
      Handler: app.lambdaHandler
      Runtime: nodejs14.x
      Timeout: 3 

Testing

Test your function locally by running harness.js from the function directory:

> node harness.js
{ statusCode: 200, body: '{"message":"hello world"}' }
localTest: 7.998ms

Contributing

Start here

Author

πŸ‘€ Benjamin Smith

Show your support

Give a ⭐️ if this project helped you!

About

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published