Serverless Python Flask API template: AWS Lambda + API Gateway
Building a serverless app frees you from infrastructure management, but it is still hard to set up correctly and it can take many frustrating hours and even days to get it right. I have created this template so that you don't have to suffer like I did.
This is a complete git repository that you can clone or download and customize to your heart's content.
Content
Cloudformation (AWS SAM) template to create the AWS Lambda and API Gateway HTTP API services in your AWS account built using AWS SAM
All the IAM roles and policies required to secure and allow continuous deployment from Gitlab
Gitlab CI yaml to run a build, test and deployment on each commit to the master branch. This deploys the infrastructure as well as the code to the lambda environment.
Python project setup that uses poetry for dependency management
Makefile with targets to run common tasks easily.
-
Step by step guidance on how to get started and get your app deployed in minutes.
Setting up your AWS account
Setting up Gitlab CI/CD configuration and environment variables
BONUS content: How to set up a domain and DNS records for your API in AWS Route53
-
BONUS content: How to set up your local development environment to debug your application during development in VS Code
Access to private git repo and downloadable zip with full content