This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
root_dir=$PWD | |
venv_dir="$root_dir/venv/lib/python3.9/site-packages" | |
function_name="app-api-dev" | |
bucket_name="app-api" | |
file_name="app_dev.zip" | |
# Zip Package | |
mkdir zip && cp -r app/ zip/app/ && cp -r config.py zip/config.py \ | |
&& cd $venv_dir && zip -r9 "$root_dir/$file_name" . \ | |
&& cd "$root_dir/zip" && zip -g ../$file_name -r . \ | |
&& cd "$root_dir" && rm -r zip | |
# Upload S3 | |
cd $root_dir \ | |
&& aws s3 cp $file_name s3://$bucket_name/$file_name | |
# Update Function Lambda | |
aws lambda update-function-code --function-name $function_name --s3-bucket $bucket_name --s3-key $file_name | |
cd $root_dir | |
rm -r $file_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment