- Building Serverless Python Web Services with Zappa
- Abdulwahid Abdulhaque Barguzar
- 222字
- 2021-07-16 18:16:16
Package
Zappa provides a command to generate a build package archive locally without deploying the application:
$ zappa package production
When you run this command, Zappa automatically packages your active virtual environment into an AWS Lambda compatible package.
Internally, it replaces any local dependencies with AWS Lambda compatible, precompiled versions. These dependencies are included in the following order:
- Lambda compatible many Linux wheels from the local cache
- Lambda compatible many Linux wheels from PyPi
- Lambda-specific versions from Lambda packages (https://github.com/Miserlou/lambda-packages)
- Archive the active virtual environment
- Archive the project directory
While processing, packaging, and packing, Zappa ignores some unnecessary files such as .pyc files. If they are available, then .py will get ignored. Zappa also sets the correct execution permissions, configures package settings, and creates a unique, auditable package manifest file.
The generated package archive will be Lambda compatible. You can set a callback function that will be invoked once the archive is created:
{
"production": {
"callbacks": {
"zip": "my_app.zip_callback"
}
}
}
Here, production is your stage name and under callback, you can set the callback method by mapping to "zip". This can help you write your own custom deployment automation.
We have seen the basic uses of Zappa. Now it's time to do some practical work. We are going to build some Python application developments with Zappa, so stay tuned!
- 通信網絡基礎與設備
- 互聯網基礎資源技術與應用發(fā)展態(tài)勢(2021—2023)
- Drush User’s Guide
- React:Cross-Platform Application Development with React Native
- 物聯網安全技術
- 世界互聯網發(fā)展報告·2019
- 網絡安全應急響應技術實戰(zhàn)指南
- 5G技術與標準
- 網絡綜合布線(第2版)
- 設備監(jiān)控技術詳解
- Dart Cookbook
- 5G非正交多址接入技術:理論、算法與實現
- 物聯網
- Enterprise ApplicationDevelopment with Ext JSand Spring
- 工業(yè)以太網技術:AFDX/TTE網絡原理、接口、互連與安全