Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

zappa can easily be used to run flask apps. But it creates just one lambda function per app. Can I have a separate lambda function for each python function I declare?

like image 250
nikhilalmeida Avatar asked Jun 23 '17 22:06

nikhilalmeida


People also ask

What does Zappa do?

Zappa is a full-featured command-line tool that Lambda-fies Flask and Django applications. Technically speaking, it's a framework that packages and deploys WSGI-compatible Python applications to an AWS Lambda function. Zappa is an "easy button" for Flask and Django serverless deployment.

What is Zappa python?

Zappa is an open source tool that was developed and designed by Rich Jones, founder/CTO of Gun.io (https://www.gun.io/). Zappa was mainly designed to build and deploy serverless Python applications on AWS Lambda and API Gateway.

What's the modular path to your app's function?

What's the modular path to your app function? (default dev) The AWS Lambda function requires an attribute, such as lambda_handler, which points to a function as an entry point for Lambda execution. Hence, you need to provide information about the function name with a modular path such as <filename>.


1 Answers

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.

like image 54
mislavcimpersak Avatar answered Oct 05 '22 22:10

mislavcimpersak