This repository was archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda_manager.patch
More file actions
54 lines (46 loc) · 1.73 KB
/
lambda_manager.patch
File metadata and controls
54 lines (46 loc) · 1.73 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
--- lambda_manager.bash 2018-06-12 20:39:35.195832151 -0300
+++ ../lambdas_pyhton/lambda_rds/lambda_deployment_manager/lambda_manager.bash 2018-06-13 00:05:06.783144801 -0300
@@ -13,15 +13,15 @@
source bin/activate
# Create template for lambda
- touch lambda_function.py
- echo -e "# Import dependencies\n#import boto3" >> lambda_function.py
- echo -e "\n\ndef lambda_handler(event, context):" >> lambda_function.py
- echo -e "# mind identation" >> lambda_function.py
+ touch ${1}.py
+ echo -e "# Import dependencies\n#import boto3" >> ${1}.py
+ echo -e "\n\ndef lambda_handler(event, context):" >> ${1}.py
+ echo -e "# mind identation" >> ${1}.py
# Get Boto3
pip install boto3
- echo -e "\nReady to begin, please open the file lambda_function.py"
+ echo -e "\nReady to begin, please open the file ${1}.py"
}
@@ -32,20 +32,20 @@
# Put together every file on the deployment package
mkdir build_sources
- cp lambda_function.py build_sources
- cp -r lib/python*/* build_sources
- cd build_sources && zip -r lambda_function.zip *
+ cp ${1}.py build_sources
+ cp -r lib/python*/site-packages/* build_sources
+ cd build_sources && zip -r ${1}.zip *
# Deploy to AWS
aws lambda create-function \
---function-name lambda_function \
---zip-file fileb://${PWD}/lambda_function.zip \
---role ${1} \
---handler lambda_function.lambda_handler \
+--function-name ${1} \
+--zip-file fileb://${PWD}/${1}.zip \
+--role ${2} \
+--handler rds_function.lambda_handler \
--runtime python2.7 \
--timeout 60 \
--memory-size 1024
- rm -fr build_sources
- echo -e "\nlambda_function.py deployed!\nCheck out AWS"
+ cd .. && rm -fr build_sources
+ echo -e "\n${1}.py deployed!\nCheck out AWS"
}
\ No newline at end of file