All Projects → browniebroke → cookiecutter-lambda-function

browniebroke / cookiecutter-lambda-function

Licence: MIT license
A cookiecutter template to create AWS Lambda function

Programming Languages

python
139335 projects - #7 most used programming language

Cookiecutter Lambda Function

CircleCI

A cookiecutter template to create AWS Lambda function

Requirements

Install cookiecutter command line: pip install cookiecutter or brew install cookiecutter using Homebrew

Usage

Generate a new Lambda function: cookiecutter gh:browniebroke/cookiecutter-lambda-function

The generated projects uses Chalice to deploy to AWS lambda. It uses a Flask-like API to declare the entry points of your serverless infrastructure.

Your serverless application should declare its dependencies in the generated requirements.txt.

Options

  • endpoint: Create a HTTP endpoint entry point - @app.route style
  • schedule: Create a schedule event
  • timeout: Lambda function timeout (default to 60)

Vendoring a dependency

If your application depends on a 3rd party which Chalice cannot install on Lambda, they recommend vendoring the 3rd party dependency in your repository.

The generated project provides a simple command line utility to assist in doing so: bin/vendor_package.py. To use it, make sure the 3rd party is installed in your current python interpreter (e.g. PyYAML)

pip install PyYAML

And then pass the python module name as argument to the script, that is the name you use to import your 3rd party dependency from your code. PyYAML being imported with import yaml, you vendor it with:

./bin/vendor_package.py yaml 

You can pass as much arguments as you want to the script, they will be copied from your current Python interpreter to the vendor directory.

License

This project is licensed under the terms of the MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].