Git Product home page Git Product logo

albt's Introduction

Aws Lambda Build Tool

Build Status

Build and deploy projects that use AWS Lambda.

$ albt --help
Usage: albt [OPTIONS] COMMAND [ARGS]...

  AWS Lambda Build Tool

  Build and deploy projects that use AWS Lambda.

Options:
  --help  Show this message and exit.

Commands:
  deploy   Deploy lambda functions
  invoke   Invoke lambda functions
  new      Create new lambda function
  version  Display albt version

Goals

  • Simplify deploying and invoking lambda functions with less flags.
  • Configure projects with yaml files instead of using multi line command line attributes.
  • Automate zip file creation of lambda functions that use external packages or custom libraries.
  • Integrate with services that use Lambda functions such as API Gateway.

Installing

Requirements

Aws cli is a required pre-installation step, or at minimum creating a credentials file.

$ aws configure

This will prompt for credentials and set up the ~/.aws/credentials file.

Install from pip

$ pip install albt

Usage

Creating

Create a new function in current directory

$ albt new . my_function

Create a new function with specific role and handler

$ albt new . my_function --role=arn:aws:iam:::role/my_role --handler=my_handler

Deploying

Deploy an entire directory of functions

$ albt deploy .

Deploy a single function

$ albt deploy . lambda_function

Deploy to a specific region

$ albt deploy . lambda_function --region=us-west-2

Invoking

Invoke a function

$ albt invoke . my_function

Invoke a function with a json payload

$ albt invoke . my_function --payload=payloads/new.json --invoketype="RequestResponse"

Environment

Add an environment variable

Edit the function config yaml file.

vi my_function.yml
FunctionName: my-function-name
MemorySize: 128
Timeout: 15
Environment:
  Variables:
      Debug: 'True'

Add code to lambda function to retrieve environment variable

import os
DEBUG = os.environ['Debug'] == 'True'

Building

Local development installation

$ virtualenv venv
$ . venv/bin/activate
$ pip install --editable .

Create source distributuion

python setup.py sdist

Install wheel

pip install wheel

Install universal

python setup.py bdist_wheel --universal

Uploading to PyPi

twine upload dist/*

Signing and uploading to PyPi

gpg --detach-sign -a dist/albt-<VERSION>.tar.gz
twine upload dist/albt-<VERSION>.tar.gz dist/albt-<VERSION>.tar.gz.asc

TODO

  • Add swagger file generation and import for api gateway lambda project
  • Add cloud formation for project roles policies and resources

License

MIT

albt's People

Contributors

geothird avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.