-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.mk
30 lines (23 loc) · 1.17 KB
/
deploy.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SHELL := /bin/bash
AWS_CLI_URL="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
MESSAGE ?= 'none'
install-aws-cli:
curl $(AWS_CLI_URL) -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws --version
update-lambda:
aws lambda update-function-code --function-name ${FUNCTION_NAME} --zip-file fileb://lambda.zip
invoke:
aws lambda invoke --function-name ${FUNCTION_NAME} --payload ${PAYLOAD} ./response.json
check-response:
$(eval ERROR := $(shell jq 'select(.errorMessage != null) | .errorMessage' ./response.json))
@if [ ${ERROR} ]; then\
echo ${ERROR};exit 1; \
fi
publish-lambda:
$(eval VERSION := $(shell aws lambda publish-version --function-name ${FUNCTION_NAME} --description "$(shell echo '${MESSAGE}' | cut -c1-250)" --query 'Version' --output text))
aws lambda update-alias --function-name ${FUNCTION_NAME} --name master --function-version ${VERSION}
update-glue:
aws s3 cp ./scripts/${SCRIPT} s3://prod-recommendation/horizon/alice/scripts/${SCRIPT}
aws glue update-job --job-name ${JOB_NAME} --job-update Role=AWSGlueServiceRole,Command="{Name=glueetl,ScriptLocation=s3://prod-recommendation/horizon/alice/scripts/${SCRIPT},PythonVersion=3}"