Skip to main content

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"
-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

  1. Click run and debug

  2. Click create a launch.json file

  3. Choose Python

  4. Choose Module

  5. After this process, VSCode will create a file called launch.json in the .vscode folder located at the root of the project

  6. 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",
                    "-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

awslambdalocal-1.0.5.tar.gz (134.9 kB view details)

Uploaded Source

Built Distribution

awslambdalocal-1.0.5-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

Details for the file awslambdalocal-1.0.5.tar.gz.

File metadata

  • Download URL: awslambdalocal-1.0.5.tar.gz
  • Upload date:
  • Size: 134.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for awslambdalocal-1.0.5.tar.gz
Algorithm Hash digest
SHA256 3567c9569eb4941a2df849fe509dbcbac87be69f797a7fc1cba7cf8b12a36444
MD5 16c1380fb6419dd2e9d1341ad6af6d75
BLAKE2b-256 14915a8bc921d4aada08a7d94665108d5205c415dd05813108b1a41c513a1fee

See more details on using hashes here.

File details

Details for the file awslambdalocal-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: awslambdalocal-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for awslambdalocal-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c6a2e10e94edea18303ad85c9b849004c2bd756fd8cceaca320c71b44568d476
MD5 203bf4520de5796ba1b9de565a552722
BLAKE2b-256 98900a7841e1e88654c6c877517012b0caefdee3aee9a8fc97f09c7000eee9d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page