https://github.com/rpivo/python-lambda-bundler
Bundle any Python function and its dependencies for Lambda with Docker and Amazon Linux
https://github.com/rpivo/python-lambda-bundler
amazonlinux aws bundler docker lambda linux python
Last synced: about 1 year ago
JSON representation
Bundle any Python function and its dependencies for Lambda with Docker and Amazon Linux
- Host: GitHub
- URL: https://github.com/rpivo/python-lambda-bundler
- Owner: rpivo
- Created: 2021-02-28T13:58:40.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-25T13:51:47.000Z (almost 5 years ago)
- Last Synced: 2025-01-08T21:40:14.556Z (about 1 year ago)
- Topics: amazonlinux, aws, bundler, docker, lambda, linux, python
- Language: Shell
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# python-lambda-bundler
A simple template for bundling any Python function for Lambda and Amazon Linux.
> Note: This template currently bundles Python 3.8, but this can be changed inside build.sh.
### Why use Docker?
If you're using a non-Linux operating system as your development machine, you'll need to bundle Python dependencies for Linux somehow. This setup uses the `amazonlinux` Docker image to bundle Python dependencies for Lambda.
### Setup
To build the Lambda zip:
- Create an environment file inside the sh folder called **env.sh** that exports a `LOCAL_PATH` variable representing the current directory where the build will occur. Ex:
```sh
export LOCAL_PATH=~/Documents/projects/my-folder;
```
- Add Python package dependencies to build.sh (see `# install python dependencies` section).
- Start Docker.
- Run `sh start.sh`.
If you plan on running this Docker setup on multiple projects, **you should rename the container as specified inside the start.sh file** (which is named as `bundler` currently) so that a different container that specifies a bind mount with the specific path is used for the project.