As discussed in #2188, AWS recently announced container image support for AWS Lambda. This means you can now package and deploy lambda functions as container images, instead of using zip files. The container image based approach will solve a lot of headaches caused by the zip file approach, particularly with file sizes (container images can be up to 10GB) and the dependency issues we all know & love.
What does this PR do?
Make the zappa update and zappa deploy commands accept a new docker_image_uri parameter. docker_image_uri must point to an image in Elastic Container Registry (ECR) that complies with these guidelines. Instructions on how to configure this docker image will be provided in an accompanying blog post.
Add a new save-python-settings-file CLI command, which will be used to generate & save the zappa_settings.py file that must be included in your docker image
Reproducible example
See this repo which contains an example Dockerfile that can be used for testing.
Any other key zappa workflows that should be updated and/or tested in conjunction with this? I've tested the zappa update,zappa deploy,zappa rollback` commands for both creating from a zip file (traditional method) and from a docker image (new method)
If you would like this PR to be a bit smaller, I can pull out some of the stuff (new save-python-settings-file command, wait until lambda is ready function, etc.) into separate PRs
Future Work & Next Steps
Add functionality to zappa to create new docker images. We've lost some of the zappa magic since you can no longer do a "1-line create & deploy" with zappa deploy, you need to first create your own docker and then deploy.
Implement zappa rollback, see this comment for details
Coverage decreased (-16.6%) to 56.417% when pulling 9dfdf8cc6700973a35a3b433258adaee2803b107 on ian-whitestone:add-docker-support into 542c8c60291ebc5ece03b8dd4abe9e0172715086 on Miserlou:master.
Background
As discussed in #2188, AWS recently announced container image support for AWS Lambda. This means you can now package and deploy lambda functions as container images, instead of using zip files. The container image based approach will solve a lot of headaches caused by the zip file approach, particularly with file sizes (container images can be up to 10GB) and the dependency issues we all know & love.
What does this PR do?
zappa update
andzappa deploy
commands accept a newdocker_image_uri
parameter.docker_image_uri
must point to an image in Elastic Container Registry (ECR) that complies with these guidelines. Instructions on how to configure this docker image will be provided in an accompanying blog post.save-python-settings-file
CLI command, which will be used to generate & save thezappa_settings.py
file that must be included in your docker imageReproducible example
See this repo which contains an example
Dockerfile
that can be used for testing.Discussion points for reviewers
zappa update,
zappa deploy,
zappa rollback` commands for both creating from a zip file (traditional method) and from a docker image (new method)save-python-settings-file
command, wait until lambda is ready function, etc.) into separate PRsFuture Work & Next Steps
zappa deploy
, you need to first create your own docker and then deploy.zappa rollback
, see this comment for details