Generating Cookiecutter templates for AWS Lambdas

Python package-ish templates and Infrastructure as Code

This same idea can be applied to any directory structure, and one that I'm keen to try next is AWS Lambda functions. AWS themselves have a sort of templating tool that gives you 1-click setup from templates (CloudFormation YAML embedded in links).

CloudFormation is a very verbose form of Infrastructure as Code (IaC) which can make it difficult to read at a glance compared to a framework built on top of it, such as the Serverless framework.

Some examples I've come across:

cookiecutter-serverless-aws-lambda shows how to use tox alongside a Serverless framework Python Lambda, though the Dockerfile, Makefile, Pipfile, setup.py, setup.cfg, and sls.sh are all way too much icing on the cake to me.

cookiecutter-fastapi-serverless shows a FastAPI Serverless service: now this is more like it. If I wanted to try out the popular library this is how I'd start.

cookiecutter-lambda-function has an odd layout: a bin/ and vendor/ directory for "an existing vendored dependency" (?), and deploying to AWS Lambda with a Python framework called Chalice. Not keen on this.

Much like with the Python package templates, none of these examples provide what I want, so I'll look into creating my own bespoke template.

This part is still being written, please check back again later...

If you enjoyed this series or you have a nagging question with something I did, let me know your thoughts on Twitter! @permutans