Can zappa be used to run functions directly (non wsgi apps) Can zappa be used to run functions directly (non wsgi apps) python-3.x python-3.x

Can zappa be used to run functions directly (non wsgi apps)


Since this is the first SO result that you get when searching for zappa for non-wsgi I'll share my 2 cents.

If you just want use Zappa to deploy to AWS Lambda and be able to invoke your function without actually using WSGI you can do something like this:

myapp.py

def foo(event, context):    print('foo bar')    return 'lambda triggered!'

zappa_settings.json

{    "dev": {        "lambda_handler": "myapp.foo",        ...    }}

Now go to your AWS Lambda console in browser and click Test and see the function being triggered.


You can create 'command' trigger events like below and zappa will invoke your python function:

{   "command": "mymodule.myfunction"}

Your app doesn't have to be a wsgi app. You can create each lambda function individually & upload the same zappa package as zip on each of them.