Skip to content

Instantly share code, notes, and snippets.

@zynaxsoft
Last active October 31, 2019 03:10
Show Gist options
  • Save zynaxsoft/eeee5222636de23a6a746b29da7ec484 to your computer and use it in GitHub Desktop.
Save zynaxsoft/eeee5222636de23a6a746b29da7ec484 to your computer and use it in GitHub Desktop.
deploy lambda
#!/bin/bash
set -e
FUNCTION_NAME="tanapol_test"
source .env/bin/activate || python3.7 -m venv .env;source .env/bin/activate
python3 --version
pip3 install -r requirements.txt
deactivate
cd .env/lib/python3.7/site-packages
zip -r9 ${OLDPWD}/function.zip .
cd ${OLDPWD}
zip -g function.zip lambda_function.py
echo "Uploading..."
aws lambda update-function-code --function-name ${FUNCTION_NAME} --zip-file fileb://function.zip
@zynaxsoft
Copy link
Author

Usage

This script assumes that you have set up awscli first
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
Also awscli is already configured by aws configure

  1. change FUNCTION_NAME
  2. run the script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment