LambdaMaker
LambdaMaker is a simple, modular Python utility that automates the creation, packaging, configuration, and deployment of AWS Lambda functions, especially those processing and/or triggered from s3, using only standard Python and boto3.
🚀 Features
- Package Python-based Lambda functions from local code and dependencies
- Create an IAM role with appropriate permissions
- Deploy the Lambda function to AWS
- Set environment variables from a
.envfile - Optionally configure S3 bucket triggers for Lambda execution
- Supports a JSON config file for consistent and repeatable deployment
📦 Installation
You can install LambdaMaker directly from PyPI:
pip install lambdamaker
⚙️ Requirements
LambdaMaker was developed and tested using Python 3.12, which is currently supported by AWS Lambda. However, the version can be configured (see python_version below).
- You must have valid AWS credentials configured in
~/.aws(viaaws configureor similar). - If using S3 triggers, the S3 bucket must already exist.
- Docker must be installed and running if
use_dockeris set totrue. If Docker Desktop is required, ensure it is manually started before running. - If
openai,pydantic, or other compiled dependencies are used, settinguse_dockeris strongly recommended.
🔧 Configuration
All routines look for config.json, requirements.txt, and my.env in the same working directory by default. You can override this by passing a working_dir parameter to any of the functions.
By default, any additional Python source files specified under mylib_files in the configuration will be copied from a directory named mylib in the user's home folder ($HOME/mylib). You may override this by passing the mylib_dir parameter with a different path.
If you're using the example project in the mylambda folder in this repository, you can run the tool using working_dir="mylambda" and mylib_dir="." to pick up helloworld.py from the same folder.
Common Parameters
replace(bool, default:False): IfTrue, existing AWS resources such as the Lambda function, IAM role, or S3 triggers will be updated or replaced. IfFalse, existing resources are left untouched.working_dir(Path or str, optional): Specifies the directory whereconfig.json,requirements.txt, andmy.envare located. Defaults to the current working directory.mylib_dir(Path or str, optional): Directory from which to copy the files listed undermylib_files. Defaults to$HOME/mylib.use_docker(bool, default:False): Enables Docker-based builds to ensure compatibility with AWS Lambda Linux environment, particularly for packages requiring native binaries. When set totrue, Docker must be running or the user will be prompted.python_version(str, default: "3.12"): Specifies the Python runtime for both Docker image used during zip creation and the AWS Lambda deployment.
Example config.json
{
"lambda_name": "s3lambda",
"entry_file": "helloworld.py",
"entry_func": "lambda_handler",
"mylib_files": ["helloworld.py"],
"output_dir": ".",
"memory_size": 128,
"timeout": 120,
"ephemeral_storage": 512,
"role_name": "s3lambda",
"s3_buckets": ["*"],
"trigger_bucket": null,
"trigger_filetypes": [],
"use_docker": false,
"python_version": "3.12"
}
- The
entry_filemust be either listed inmylib_filesor included in yourrequirements.txt. my.envuses standard.envfile format:
USERNAME=World
Environment variables defined here will be injected into your Lambda runtime.
✅ Example Usage
from lambdamaker import (
create_iam_role,
create_lambda_zip,
create_or_update_lambda,
configure_s3_trigger
)
create_iam_role()
create_lambda_zip()
create_or_update_lambda()
configure_s3_trigger()
Or call the main function:
from lambdamaker import main
main() # safer default: replace=False
To use the included sample from the /mylambda folder:
main(working_dir="mylambda", mylib_dir="mylambda")
🔐 IAM and Security
The tool will:
- Automatically create an IAM role if it doesn't exist
- Attach AWSLambdaBasicExecutionRole
- Optionally grant access to S3 buckets (full or restricted)
🙣 S3 Triggers
To enable S3 triggers:
- Set
trigger_bucketto a valid bucket name - Set
trigger_filetypesto a list of suffixes like[".json", ".mp4"]
The tool will:
- Add invoke permission for the bucket
- Create a trigger per suffix
- Preserve triggers for other Lambda functions on the bucket
📄 License
MIT License
Contributions and issue reports are welcome!
Metadata
Release files for lambdamaker 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lambdamaker-0.2.0.tar.gz | 4.1 kB | Without provenance | Details for lambdamaker-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lambdamaker-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for lambdamaker-0.2.0-py3-none-any.whl |
Total release size: 8.3 kB
Release files / lambdamaker-0.2.0.tar.gz
| Download URL | lambdamaker-0.2.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c609f91e23f73149467d95543f3c27f46acdfbcf0738e9175943b509dda3ad47
|
|
BLAKE2b-256 checksum How to use checksums |
d9196cbd2b9b59a419c3d2207ead06bce1101f2abe6aecea3fc242545734e033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / lambdamaker-0.2.0-py3-none-any.whl
| Download URL | lambdamaker-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da32e29489eff86882f1e2e56695419f109986fdc36940541a8f200d2c5c4f73
|
|
BLAKE2b-256 checksum How to use checksums |
6bc8c6b2d2515c49a18bbe52c58253cadfb48645940ec82d6d39dee64445ac11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for lambdamaker 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.