-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdeploy_to_lambda.sh
More file actions
executable file
·30 lines (21 loc) · 896 Bytes
/
deploy_to_lambda.sh
File metadata and controls
executable file
·30 lines (21 loc) · 896 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
#!/bin/bash
set -e
function lambda_invoke {
aws lambda invoke --function-name LambdaTest --payload "`cat data.json`" --qualifier PROD lambdaoutput.txt
cat lambdaoutput.txt
echo -e "\n"
}
cd /deploy
echo "Output before deployment"
lambda_invoke
# Change Printed Date in LambdaTest to show the difference between the deployed functions
sed -i.bu s/DATE/$RANDOM/ LambdaTest.js
# Preparing and deploying Function to Lambda
zip -r LambdaTest.zip LambdaTest.js
aws lambda update-function-code --function-name LambdaTest --zip-file fileb://LambdaTest.zip
# Publishing a new Version of the Lambda function
version=`aws lambda publish-version --function-name LambdaTest | jq -r .Version`
# Updating the PROD Lambda Alias so it points to the new function
aws lambda update-alias --function-name LambdaTest --function-version $version --name PROD
echo "Output after deployment"
lambda_invoke