A tool to simulate running an AWS Lambda locally
Project description
py-lambda-local
awslambdalocal is a tool to simulate running an AWS Lambda locally, for lambda functions in Python.
Table of Contents
Requirements
- Python => 3.8
- Poetry => 1.1.12 or another package manager that supports direct git dependencies
Install
To install awslambdalocal, we recommend adding it to your pyproject.toml in the dev-dependencies section as shown in the example below.
pip install awslambdalocal
Obs.: We recommend using Poetry. See https://python-poetry.org/docs/
About: CLI
Positional Arguments:
Argument | Description |
---|---|
lambda_path | Specify Lambda function file name. |
event_path | Specify event data file name. |
Optional Arguments:
Argument | Description |
---|---|
--help | Show this help message and exit |
-h | Lambda function handler name. Default is "lambda_handler" |
-t | Seconds until lambda function timeout. Default is 3 seconds |
-p | Read the AWS profile of the file. |
-r | Sets the AWS region, defaults to us-east-1. |
CLI Examples
# Simple usage
pyhton -m awslambdalocal main.py test-event.json
# Input all arguments
pyhton -m awslambdalocal main.py test-event.json -p my_profile -r my_region -h lambda_handler -t 30
Tutorials
This session contains a collection of tutorials.
Debug Python in VSCode
To use vscode debug with awslambdalocal follow the steps below
-
Click run and debug
-
Click create a launch.json file
-
Choose Python
-
Choose Module
-
After this process, VSCode will create a file called launch.json in the .vscode folder located at the root of the project
-
Copy and paste the json below into the launch.json file, this file aims to call the awslambdalocal module and passes the necessary and optional parameters as arguments
{ // Use o IntelliSense para saber mais sobre os atributos possíveis. // Focalizar para exibir as descrições dos atributos existentes. // Para obter mais informações, acesse: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Lambda Local", "type": "python", "request": "launch", "module": "awslambdalocal", "args": [ "file_python.py", "your_test_event.json", // Optional args ... "-h", "handler", "-t", "10", "-p", "your_profile", "-r", "us-east-1" ] } ] }
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for awslambdalocal-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b02e709a4bdd06b684690f43ab68e81274ea86a70c507028bc61a72434b8806 |
|
MD5 | 3c9bcff02d2ffd05265fd80a7079bc32 |
|
BLAKE2b-256 | 8abd62eab17146390dae340f19f8a4b40d4c1f2000b87a09319b1f6ef4ebdfd3 |