-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_to_aws_lambda.sh
More file actions
executable file
·34 lines (26 loc) · 1011 Bytes
/
deploy_to_aws_lambda.sh
File metadata and controls
executable file
·34 lines (26 loc) · 1011 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
# Parse config and set on lambda:
configvars="$(PYTHONPATH=./dependencies/ynab-v1/ python3 ./src/mail_to_ynab.py dump-config)"
echo "$configvars"
aws lambda update-function-configuration --function-name MailToYnab --environment "$configvars"
# Set entry point:
aws lambda update-function-configuration --function-name MailToYnab --handler mail_to_ynab.lambda_handler
# Create build folder:
rm -rf ./build
mkdir ./build
# Copy source:
cp ./src/*.py ./build/
# Copy Generated Swagger Client:
cp -R ./dependencies/ynab-v1/swagger_client ./build
# Install Dependencies:
pip install certifi -t ./build
pip install imapclient -t ./build
pip install beautifulsoup4 -t ./build
# Zip it up:
rm ./mailtoynab_lambda.zip
cd build
zip -r ../mailtoynab_lambda.zip .
cd ..
# Upload to Lambda:
aws lambda update-function-code --function-name MailToYnab --zip-file fileb://mailtoynab_lambda.zip
# Try it:
aws lambda invoke --function-name MailToYnab --log-type Tail /tmp/lambda_out |jq -r '.LogResult' | base64 --decode