Building Serverless Python Web Services with Zappa
上QQ阅读APP看书,第一时间看更新

Configuring with Zappa

In order to configure Zappa, it's required that you have Zappa installed, as mentioned in the previous chapter. Zappa provides the zappa init command, which enables a user interactive mode initialization so that we can configure the Python application.

I followed the default configuration settings that were suggested by the zappa init command. This generates the zappa_settings.json file, which is the backbone for configuring any Python application with Zappa.

Here is the content of the zappa_settings.json file:

{
"dev": {
"app_function": "hello_world.app",
"aws_region": "ap-south-1",
"profile_name": "default",
"project_name": "flask-todo",
"runtime": "python3.6",
"s3_bucket": "zappa-yrze3w53y"
}
}

Now, during initialization, Zappa has the ability to identify the type of your Python application and generate the set attributes accordingly. In our case, Zappa detected the Python program as a Flask application. Hence, it asked for the Flask instance path, which we initialized as app = Flask(__name__) in the hello_world.py file.

Now that the Zappa configuration has been completed as per our basic needs, it's time to deploy it on AWS Lambda.