Skip to content

Instantly share code, notes, and snippets.

@mshakhomirov
Created October 12, 2019 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshakhomirov/ee26eadb038ff2c2aba06e79de9b1007 to your computer and use it in GitHub Desktop.
Save mshakhomirov/ee26eadb038ff2c2aba06e79de9b1007 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# chmod +x the_file_name
base=${PWD##*/}
zp=$base".zip"
echo $zp
rm -f $zp
zip -r $zp * -x deploy.sh
if ! aws lambda create-function \
--function-name gcs-transfer \
--description "Sync files from S3 to Google Cloud Storage" \
--handler index.handler \
--runtime nodejs8.10 \
--role arn:aws:iam::1234567890:role/your_role_dataload_lambda \
--zip-file fileb://$zp;
then
echo ""
echo "Function already exists, updating instead..."
aws lambda update-function-code \
--function-name gcs-transfer \
--zip-file fileb://$zp;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment