FastAPI is a modern fast (high-performance) web framework for building APIs with Python.
FastAPI features
FastAPI gives you the following, based on open standards
- OpenAPI for API creation, including declarations of path operations, parameters, body requests, security, etc.
- Automatic data model documentation with JSON Schema (as OpenAPI itself is based on JSON Schema).
- Allows using automatic client code generation in many languages.
In this blog we are going to learn how to deploy containerised FastAPI Application using AWS Lambda and API Gateway.
FastAPI in Containers -Docker :
When deploying FastAPI applications, a common approach it is to build a Linux container image. It’s normally done using Docker. Then you can deploy that container image in Lambda . There are several advantages of using Linux containers, including security, replicability, simplicity, and others.
Architecture :
As per below Architecture , end users can able to access the FastAPI api endpoint either using Lambda URL or using API Gateway endpoint.