Contains common CLI commands to build, test and upload AWS Lambda.
Uses AWS CloudFormation template.
Docker commands can be executed without root privileges.
- **Docker must be running in the background
-
sudo ln -sf "$HOME/.docker/run/docker.sock" /var/run/docker.sock
Compile (@ lambda func level)
-
tsc
Build (@ project root)
-
sam build
Invoke Lambda locally with event (@ project root)
-
sam local invoke SendEmailFunction --event lambdas/sendEmailFunc/event.json
Invoke Lambda locally with no event (@ project root)
-
sam local invoke SendEmailFunction
Zip Lambda
-
zip -r {path_to_lambda_dist}/{lambda_func}.zip \*
Zip Lambda and upload (@ lambdas/{func_name}/dist)
-
zip -r -D lambda.zip \* && aws lambda update-function-code --function-name {lambda_func} --zip-file fileb://lambda.zip --profile {profile}