Skip to content

nicor88/aws-python-lambdas

Repository files navigation

aws-python-lambdas

Collection of python lambda function

Setup Conda Env

# create env
conda env create -n aws-python-lambdas -f conda-dev-env.yml
# activate env
source activate aws-python-lambdas
# after installing new libs update conda-dev-env.yml
conda env export --file conda-dev-env.yml 

Building

source activate aws-python-lambdas
# build lambda function contained inside src/hello_world
python build.py --src-path src/hello_world --dist-path dist

By default the upload to S3 is disabled, but it's possible to upload the lambda to S3 based on the config specified for each lambdas running the following command:

# upload to s3
python build.py --src-path src/hello_world --dist-path dist --s3-upload True

Build with external packages (dev-mode)

source activate aws-python-lambdas
python build_with_packages.py --lambda-path src/read_yaml
# upload to s3
python build_with_packages.py --lambda-path src/read_yaml --s3-upload True

Structure

└── src/
    ├── hello_world_lambda
    │    ├── __init__.py      
    │    ├── config.yml
    │    └── lambda_function.py
    └── lambda_function_test_
         ├── __init__.py      
         ├── config.yml
         └── lambda_function.py            

Where:

  • init.py is an empty file used during the building to retrieve th yml
  • config.yml contain the config of the lambda (e.g. s3_bucket, s3_key, libs needed for the lambda)
  • lambda_function.py contains the real lambda with this structure
def lambda_handler(event, context):
    something = 'hello_world'
    return something

About

Collection of AWS Lambda functions in Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published