Skip to content

Commit e9fe7aa

Browse files
committed
Add hot reload deploy options
1 parent 8675302 commit e9fe7aa

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lambda-debugging-sam-javascript/Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: usage install build build-docker build-local build-sam wait deploy deploy-aws deploy-sam invoke clean start stop ready test-ci
1+
.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
22

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

59+
deploy-aws-hot-reload: ## Deploy the Lambda function with hot reload via AWS CLI
60+
$(AWS) lambda create-function \
61+
--function-name $(FUNCTION_NAME) \
62+
--runtime $(LAMBDA_RUNTIME) \
63+
--role arn:aws:iam::000000000000:role/lambda-role \
64+
--handler app.lambdaHandler \
65+
--code S3Bucket="hot-reload",S3Key="/$$PWD/hello-world" \
66+
--timeout 2
67+
5968
deploy-sam: ## Deploy the Lambda function via AWS SAM CLI
6069
$(SAM) deploy
6170

6271
invoke: ## Invoke the Lambda function and show logs
6372
AWS_MAX_ATTEMPTS=1 $(AWS) lambda invoke --function-name $(FUNCTION_NAME) \
73+
--cli-binary-format raw-in-base64-out \
6474
--payload file://events/event.json \
6575
--cli-connect-timeout 3600 \
6676
--cli-read-timeout 3600 \
@@ -88,3 +98,9 @@ ready: ## Wait until LocalStack is running
8898
test-ci:
8999
make start install ready deploy wait invoke; return_code=`echo $$?`;\
90100
echo "Interactive debugging not tested in CI"; exit $$return_code;
101+
102+
enable-hot-reload: ## Enable hot reload via AWS CLI
103+
$(AWS) lambda update-function-code \
104+
--function-name $(FUNCTION_NAME) \
105+
--s3-bucket "hot-reload" \
106+
--s3-key "$$PWD/hello-world"

0 commit comments

Comments
 (0)