-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-lambda.sh
More file actions
executable file
·46 lines (37 loc) · 994 Bytes
/
deploy-lambda.sh
File metadata and controls
executable file
·46 lines (37 loc) · 994 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#
# Deploys survivorpool-backend to AWS Lambda.
set -o errexit
set -o pipefail
declare basedir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd ${basedir}
if [[ $# -ne 1 ]]
then
echo "Missing required argument: <environment> (test or prod)"
exit 1
fi
environment="$1"
lambdaFunName=""
if [[ "${environment}" == "test" ]]
then
lambdaFunName="survivorpool-test"
elif [[ "${environment}" == "prod" ]]
then
lambdaFunName="survivorpool"
else
echo "Unrecognized environment: '${environment}'. Must be 'test' or 'prod'."
exit 1
fi
buildDir="dist"
buildArtifact="survivorpool-backend.zip"
fullArtifact="${buildDir}/${buildArtifact}"
if [[ ! -f ${fullArtifact} ]]
then
echo "You have not yet built ${fullArtifact}. Run build-js.sh first."
exit 1
fi
echo "Deploying ${fullArtifact} to AWS Lambda function ${lambdaFunName}"
if aws lambda update-function-code --function-name ${lambdaFunName} --zip-file fileb://${fullArtifact} --publish
then
echo "Success"
fi