AWS Lambda function generator. Provide lambda function create/update/delete wrap. Include connecting lambda to inputed S3 bucket.
Install and use generator
# install generator
npm install -g generator-lambda
# run
yo lambda
➜ tree
.
├── Makefile
├── index.js
└── package.json
0 directories, 3 files
index.js
Function code here, please do not change the file name, if you want, please change theMakefile
too.Makefile
Wrap of aws cli, provide function create/update/deletepackage.json
Any extra dependency here, usenpm i --save
for reuse.
# create function, and connect it with inputed s3 bucket
make create
# update function code
make
# test lambda function with a mock S3 PUT event
make S3
# delete function
make delete
Use the aws lambda invoke
command to test deployed lambda function with a mock s3 PUT
event.
The command will print the log produced by the lambda function, which can also be seen in the AWS CloudWatch service.
The mock data can be found in input/input-s3.json
. It is much like a demo, feel free to edit it.
Note: If you want to Read/Write the resource referred in the event, please make sure your do own them.
MIT