Keith Gaughan

An attempt at public introspection


Creating AWS Lambda functions in Python with dependencies

· 1min

This assumes you have a package called mylambda and a requirements.txt file listing your dependencies.


tmp_dir=$(mktemp -d)
trap "rm -rf '$tmp_dir'" EXIT

pip install -r requirements.txt -t "$tmp_dir"
cp -R mylambda "$tmp_dir/mylambda"

    cd $tmp_dir
    zip -r -9 $here/ .

For installation of the dependencies to work, you need this setup.cfg file in the same directory as so pip can find it: