-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·71 lines (61 loc) · 1.3 KB
/
deploy.sh
File metadata and controls
executable file
·71 lines (61 loc) · 1.3 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# deploy lambdakubectl function to aws
# author: @jacobbaloul
#
#
function check_error(){
if test $? -gt 0 ; then
echo "oops! something went wrong, aborting."
exit 1
fi
}
#
##
## BEGIN
##
source settings.conf
check_error
echo "
deleting old zip...
"
rm lambdakubectl.zip
# check_error
cp ~/.kube/config ./config
chmod a+rw ./config
echo "
packaging lambdakubectl, creating new zip...
"
zip lambdakubectl.zip config lambdakubectl.js README.md package.json bin/*
check_error
echo "
removing old lambda function (deleting zip remotely) from amazon aws lambda...
"
aws lambda delete-function \
--function-name lambdakubectl \
--profile $PROFILE \
--region $REGION
#--# add if exist logic ^
#--# check_error
echo "
uploading new zip to lambda...
"
aws lambda create-function --timeout 10 --function-name lambdakubectl --zip-file fileb://lambdakubectl.zip --role $IAMARN --handler lambdakubectl.handler --runtime nodejs6.10 --profile $PROFILE --region $REGION
check_error
echo "
testing new lambda function by invoking...
"
aws lambda invoke \
--invocation-type RequestResponse \
--function-name lambdakubectl \
--region $REGION \
--log-type Tail \
--payload file://input.txt \
--profile $PROFILE \
--output json \
outputfile.txt
check_error
echo "
=======
SUCCESS: lambdakubectl has been deployed
=======
"