Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lambda-debugging-sam-javascript/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: usage install build build-docker build-local build-sam wait deploy deploy-aws deploy-sam invoke clean start stop ready test-ci
.PHONY: usage install build build-docker build-local build-sam wait deploy deploy-aws deploy-aws-hot-reload deploy-sam invoke clean start stop ready test-ci enable-hot-reload

AWS_ENDPOINT_URL ?= http://localhost.localstack.cloud:4566
AWS ?= AWS_ENDPOINT_URL=$(AWS_ENDPOINT_URL) \
Expand Down Expand Up @@ -56,11 +56,21 @@ deploy-aws: ## Deploy the Lambda function via AWS CLI
--zip-file fileb://hello-world/hello-world-javascript.zip \
--timeout 2

deploy-aws-hot-reload: ## Deploy the Lambda function with hot reload via AWS CLI
$(AWS) lambda create-function \
--function-name $(FUNCTION_NAME) \
--runtime $(LAMBDA_RUNTIME) \
--role arn:aws:iam::000000000000:role/lambda-role \
--handler app.lambdaHandler \
--code S3Bucket="hot-reload",S3Key="/$$PWD/hello-world" \
--timeout 2

deploy-sam: ## Deploy the Lambda function via AWS SAM CLI
$(SAM) deploy

invoke: ## Invoke the Lambda function and show logs
AWS_MAX_ATTEMPTS=1 $(AWS) lambda invoke --function-name $(FUNCTION_NAME) \
--cli-binary-format raw-in-base64-out \
--payload file://events/event.json \
--cli-connect-timeout 3600 \
--cli-read-timeout 3600 \
Expand Down Expand Up @@ -88,3 +98,9 @@ ready: ## Wait until LocalStack is running
test-ci:
make start install ready deploy wait invoke; return_code=`echo $$?`;\
echo "Interactive debugging not tested in CI"; exit $$return_code;

enable-hot-reload: ## Enable hot reload via AWS CLI
$(AWS) lambda update-function-code \
--function-name $(FUNCTION_NAME) \
--s3-bucket "hot-reload" \
--s3-key "$$PWD/hello-world"
Loading