@aaneto/lambda-ts-cli 中文文档教程
ts-lambda-cli
一个简单的 CLI 工具,用于调用和部署基于 typescript 项目的 lambda 函数。
使用 sudo npm i -g @aaneto/lambda-ts-cli
全局安装或使用 npm i --save-dev @aaneto/lambda-ts-cli
在本地安装
Using the CLI
以使用在 CLI 中,您必须定义三个环境变量:
- AWSKEYID
- AWS_SECRET
- AWS_REGION
您可以手动执行此操作,也可以添加一个 .env 文件在项目的根路径中设置这些变量(脚本将从中运行)。
.env 文件示例:
AWS_KEY_ID=$YOUR_KEY_ID
AWS_SECRET=$YOUR_SECRET
AWS_REGION=$YOUR_REGION
AWS_ROLE$YOUR_LAMBDA_ROLE
How to deploy a function
- Build your typescript app
- run
lambda-ts deploy -f $FUNCTION_NAME -r $FUNCTION_ROLE -b $PATH_TO_BUILD_FOLDER
- If you provide the function role in the .env file, you don't need to do it on the cli
- You should see the response on the terminal and the lambda on the AWS panel
将创建新函数,如果您的函数已经存在,则只会更新代码
How to invoke a function
- Function without payload:
lambda-ts invoke -f $FUNCTION_NAME
- Function with payload:
lambda-ts invoke -f $FUNCTION_NAME -p '{"ddd": 11}'
ts-lambda-cli
A simple CLI tool to invoke and deploy lambda functions based on typescript projects.
Install globally with sudo npm i -g @aaneto/lambda-ts-cli
or locally with npm i --save-dev @aaneto/lambda-ts-cli
Using the CLI
To use the CLI you must define three environment variables:
- AWSKEYID
- AWS_SECRET
- AWS_REGION
you can do this manually, or you can add a .env file setting these variables in the root path of your project (where the script will be run from).
Example of a .env file:
AWS_KEY_ID=$YOUR_KEY_ID
AWS_SECRET=$YOUR_SECRET
AWS_REGION=$YOUR_REGION
AWS_ROLE$YOUR_LAMBDA_ROLE
How to deploy a function
- Build your typescript app
- run
lambda-ts deploy -f $FUNCTION_NAME -r $FUNCTION_ROLE -b $PATH_TO_BUILD_FOLDER
- If you provide the function role in the .env file, you don't need to do it on the cli
- You should see the response on the terminal and the lambda on the AWS panel
New functions will be created, if your function already exists, only the code will be updated
How to invoke a function
- Function without payload:
lambda-ts invoke -f $FUNCTION_NAME
- Function with payload:
lambda-ts invoke -f $FUNCTION_NAME -p '{"ddd": 11}'
你可能也喜欢
- 6nimmt-utils 中文文档教程
- @0xsequence/guard 中文文档教程
- @180hbtech/angular-prepare-others-languages 中文文档教程
- @1d/components 中文文档教程
- @1onlinesolution/dws-http 中文文档教程
- @2-bit/storylab 中文文档教程
- @3rdvision/epir-papyrus-api 中文文档教程
- @4everland/cluster-cli 中文文档教程
- @4lolo/resize-observer-polyfill 中文文档教程
- @4tunaio/4tuna-iot-node-red 中文文档教程