run code or subprocess on aws lambda invoke context
Project description
lambda-run
run python code or shell commands on aws lambda invoke context
install:
# use bare package for production
$ pip install lambda-run
# use to install dev dependencies
# needed to execute commands from cli
$ pip install lambda-run[cli]
usage:
wrap your lambda function like this:
import lambda_run
# wrapping will catch 'lambdaRun' events
# otherwise it will pass the event forward
@lambda_run.wrap_handler
def lambda_handler(event, context):
# your regular lambda handler...
print(event, context)
return 'OK'
execute commands from cli:
# set AWS env vars for boto3
export AWS_PROFILE=profile AWS_DEFAULT_REGION=eu-west-1
# Usage: lambda-run [OPTIONS] FUNCTION_NAME [PAYLOAD]
# attach payload directly as last argument
lambda-run -m python my-lambda 'import sys; print(sys.path)'
# or by posix pipe/redirect, for example:
# pipe it
echo 'import sys; print(sys.path)' | lambda-run -m python my-lambda
# oneliner redirect
lambda-run -m shell my-lambda <<<'python manage.py createsuperuser'
# or multiline
lambda-run -m python my-lambda <<EOF
for i in range(10):
print(i)
EOF
# or file content
lambda-run -m shell my-lambda <bash-script.sh
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lambda-run-0.0.3.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lambda-run-0.0.3.tar.gz.
File metadata
- Download URL: lambda-run-0.0.3.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74a482a41d013fc296553559cbed67846f764fceb5c510e800c67176c36d05bb
|
|
| MD5 |
383d50173f5e45ed2477c97123a810c5
|
|
| BLAKE2b-256 |
7425b735130402d6b8801f601065a87c59bd6a7afc6f91471bc661ea578e7130
|
File details
Details for the file lambda_run-0.0.3-py3-none-any.whl.
File metadata
- Download URL: lambda_run-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b960a0f74bf1451b55402d2841f466999ac8e086389812fe566a7e37a6aebd15
|
|
| MD5 |
1f3a00af1dcea94ef89eb98ceb6a60a6
|
|
| BLAKE2b-256 |
ec2a4b366b60ab73bba22c0b390b8448f8b67a6cb9c4b6bc771ba6abd106f177
|