Deploying Django Docker Images To AWS Lambda Container
A proof of concept way to deploy a Django image to AWS Lambda
As of Dec 2020, AWS Lambda functions can be packaged and deployed as containers images. This new change has significant implications, it allows the developer to take advantage of the benefits provided by AWS lambda i.e. operational simplicity, automatic scaling, high availability etc, without some of the limitations associated i.e. it can be difficult to deploy custom native binaries such as ffmpeg or gdal to it.
It is worth noting that one can deploy such binaries using AWS Lambda Layers to solve some of this challenges, but it is less natural than packaging all the required dependencies as a single image.
The advantage of using containers as opposed to layers is that there is a level of familiarity with container tooling, workflows and dependencies. However, since lambda containers are a new thing (when this document was written), there is little documentation regarding how to deploy a Django application image to Lambda and no existing tooling that exists of how to do this(to my knowledge). Currently the conventional way to deploy Django applications directly into AWS Lambda, is by using the Zappa python library. The library makes it easy to build and deploy sever-less, event-driven Python…