Building the Lambda as a ZIP package

Install ZIP if it is not installed already. For Ubuntu/Debian, you can use sudo apt-get install zip -y. Create a file called create-lambda-package.sh with the following content:

#!/bin/sh
#setup environment variables
. ./common-variables.sh

#Create Lambda package and exclude the tests to reduce package size
(cd ../../lambda_dynamo_read;
mkdir -p ../package/
zip -FSr ../package/"${zip_file}" ${files} -x *tests/*)

This will create a ZIP file of the Lambda code only if the source code has changed. This is what will be deployed to AWS and there are advantages in separating these commands when we need to package third-party libraries.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset