Skip to main content

Python 3.6+ module to make Flask compatible with AWS Lambda

Project description

Write Flask applications that support being run in in AWS Lambda behind API Gateway.

This project was forked from:


  • Expose original input event from AWS on Flask’s request object
  • Production-grade logging


  • Python 3.6+
  • Flask 0.10+


pip install flask-lambda-support


Here is an example of what a Flask app using this library would look like:

from flask_lambda import FlaskLambda

app = FlaskLambda(__name__)

@app.route('/foo', methods=['GET', 'POST'])
def foo():
   data = {
       'form': request.form.copy(),
       'args': request.args.copy(),
       'json': request.json
   return (
       json.dumps(data, indent=4, sort_keys=True),
       {'Content-Type': 'application/json'}

if __name__ == '__main__':

You can access the original input event and context on the Flask request context:

from flask import request

assert request.aws_event['input']['httpMethod'] == 'POST'
assert request.aws_context.get_remaining_time_in_millis() == 10_000


You can publish a new version to PyPI with the following commands:

python3 sdist bdist_wheel
twine upload PATH_TO_WHL_FILE

[Refer to the official documentation on Python packaging for more information](

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flask-lambda-support, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size flask_lambda_support-0.1.5-py36-none-any.whl (10.5 kB) File type Wheel Python version py36 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page