8000 GitHub - nomadicj/local-lambda-toolkit: A starting point repository for rapid AWS Lambda software development · GitHub
[go: up one dir, main page]

Skip to content

nomadicj/local-lambda-toolkit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

New Project

Clone this repo as a starting point for Lambda development.


Local Lambda Toolkit

A set of conventions for local AWS Lambda software development.

Directory Structure

.
├── Makefile                           # Definition of `make` targets.
├── builds                             # Builds directory.
│   ├── deploy-2016-08-15_16-50.zip
│   └── deploy-2016-08-15_16-54.zip
├── cloudformation                     # CloudFormation template and parameters.
│   └── parameters.json
│   └── template.yaml
├── index.py                           # Entry point for the Lambda function.
├── my_lambda_package                  # Python package `my_lambda_package`.
│   ├── __init__.py
│   ├── localcontext.py
│   ├── utility.py
├── requirements                       # External dependencies.
│   ├── common.txt
│   ├── dev.txt
│   └── lambda.txt
└── tests                              # Unit tests for the package.
    ├── __init__.py
    └── my_lambda_package
        ├── __init__.py
        ├── test_localcontext.py
        └── test_utility.py

1. Initial AWS Setup

Creates a CloudFormation stack with the Lambda function, an execution role, and an optional CloudWatch event to run on a recurring basis.

make create-stack

2. Initial Local Setup

Sets up your local environment for local Python development.

IAM

Assume the role created by CloudFormation by creating a new entry in ~/.aws/config:

# ~/.aws/config

[profile regular]
output = json
region = us-west-2

[profile development]
output = json
region = us-west-2
source_profile = regular
role_arn = arn:aws:iam::111111111111:role/LambdaFunctionExecutionRo-34K8PIBFMONR

Set development as the current profile via export AWS_PROFILE=development.

Python

Installs the development requirements from requirements/dev.txt.

In a new virtualenv (pyenv-virtualenv is great), install the local dependencies:

cd local-lambda-toolkit
make init

3. Run tests

Runs all the unit tests in the tests/ directory.

make test

4. Invoke the function locally

Runs the Python code on your local machine.

make invoke

5. Build a package for Lambda

Creates a deployable Lambda zip file, and places into builds.

make build

6. Deploy

Sends the build to a Lambda ARN.

ARN=arn:aws:lambda:us-west-2:111111111111:function:my-function-name make deploy

About

A starting point repository for rapid AWS Lambda software development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 68.9%
  • Makefile 31.1%
0