A tool to simulate running an AWS Lambda locally
Project description
awslambdalocal
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 |
---|---|
file | Specify Lambda function file name |
Optional Arguments:
Argument | Description |
---|---|
--help | Show this help message and exit |
-e | Specify Event data file name. REQUIRED without param -w |
-h | Lambda function handler name. Default is "handler" |
-p | Read the AWS profile of the file. |
-r | Sets the AWS region, defaults to us-east-1. |
-t | Sets lambda timeout. default: 3 |
-w | Starts lambda-local in watch mode listening to the specified port [1-65535]. |
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
-
Set the module name "awslambdalocal"
-
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", // Debug configuration name "type": "python", // Type of configuration. Python, Node and etc. "request": "launch", "module": "awslambdalocal", // Module that will be called, "cwd": "${workspaceFolder}", // Your project's root folder "args": [ "file_python.py", // Main file that will be called by lambda "your_test_event.json", //Input in json format that will be received by lambda // Optional args ... "-h", "handler", "-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
File details
Details for the file awslambdalocal-1.0.8.tar.gz
.
File metadata
- Download URL: awslambdalocal-1.0.8.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3e8c4ea2d689241ae114ceeaa0c9c4828f6a09cb6da762d38065bde61ec046f |
|
MD5 | 2e747cb350d208b672ffcc504279b7d8 |
|
BLAKE2b-256 | 3e64b438e70ed29a6bdc0165a67fd6e67aceb433a74c1e231adf35e3f2637978 |
File details
Details for the file awslambdalocal-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: awslambdalocal-1.0.8-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 855e850b2e10bfc821efa39ee3764af6f5ac91c67b710695652b63e958fafe34 |
|
MD5 | 25546b27351f1d1a4d940f6afd50f89f |
|
BLAKE2b-256 | 67613d4956ec74629d1d0d99aa66e1118ec9b27ffeb7149785cf6ae7415828fa |