This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
lambda-boilerplate/README.md
Marc Cataford f27200b29c
ci: base (#2)
* ci: base

* ci: missing bit

* ci: pyenv via action

* ci: typos

* ci: deps

* ci: typo

* ci: temp rm black

* ci: py ver

* ci: use builtin py

* ci: typo

* ci: setuptools

* ci: without subshell

* chore: normalize titles

* chore: lint

* ci: validate and lint flows

* ci: job name

* ci: pipx as module

* ci: missing dep

* ci: missing dep

* ci: pipx module

* docs: add badge
2020-09-26 11:40:18 -04:00

43 lines
2.4 KiB
Markdown

# lambda-boilerplate
🛠 Skip the boilerplate and start building fun λ things 🛠
![Lambda Boilerplate](https://github.com/mcataford/lambda-boilerplate/workflows/Lambda%20Boilerplate/badge.svg)
## Overview
AWS Lambdas are fun, but often the amount of boilerplate involved in getting a project off the ground hinders the fun. From setting up a local environment to writing out a Cloudformation template, the overhead of Lambda-based greenfield projects can be daunting. No more. Just use this repository as a template or clone it and jump straight into the action! This repository offers a quick template your can use, full with a Docker setup for local development and invocation commands that you can use to package and deploy small Lambdas.
Use this as a foundation and tweak it to your use case!
## Local development
To get started, hit the bootstrap script with `. script/bootstrap`. This will set up a Python 3.8 virtualenv set up with some basic tools that will make your life easier.
The base Lambda handler is at `src/base.py` and all the infrastructure templates and Sceptre configuration are in `infrastructure`.
[Read more about Sceptre](https://sceptre.cloudreach.com/latest/index.html)
[Read more about AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html)
### Invocations
This template uses PyInvoke, all commands are of the format `inv <command> <parameters>`.
|Command|Description|
|---|---|
|`app.start`|Start your Lambda in Docker.|
|`app.stop`|Stop and remove the container.|
|`app.invoke-function <function name> <Serialized JSON payload>`|Invokes the given local Lambda by container name|
|`stack.deploy`|Packages your code and deploys the stack|
|`stack.teardown-app`|Tears down the application stack|
|`stack.teardown-bootstrap`|Tears down the bootstrap stack|
## Deployment
The base setup assumes that your Lambda handler is located in `src.base`. Doing `inv stack.deploy` will zip up your `src` directory, create an S3 bucket for your development artifacts, uploads the source doe archive to S3 and kickstarts the Cloudformation deployment of your stack.
## Contributing
Got suggestions or improvements you'd like to make? Open a PR or [an issue](https://github.com/mcataford/lambda-boilerplate/issues)!
Feature requests should keep in mind that the goal of this boilerplate is to be general enough so that the cost of tailoring it to specific use cases is low.