At the beginning of this year, I set out to start using AWS API Gateway to proxy requests to an AWS Lambda backend. I quickly became frustrated at how complex configuring API Gateway was. As a result, I set out to create a solution that would replace API Gateway by proxying a full HTTP request in JSON format to a Lambda function.

The end result was very nice and extremely easy to use, and I had some intention of creating a paid service based on it. However, I got really busy with my actual job and those intentions never became a reality.

In late September, AWS announced support for new API Gateway proxy integration types that included Lambda proxy integration. What they have done here mirrors my own solution almost exactly, which is great for 2 reasons:

1. It verifies that I am not a raving madman (at least in this context)
2. It greatly simplifies configuring API Gateway to work with Lambda

I have decided to dust off the Python framework that I wrote to process such requests and open source it as Sippy Cup. It is an extremely minimal framework with usage similar to Flask and Chalice, albeit with an intentionally reduced feature set. It works by taking the input from API Gateway and converting it to a WSGI environment that is used to create Werkzeug-based Request and Response objects.

Sippy Cup can be installed using pip…

pip install sippycup

… and using it should seem very familar to those that have experience with similar frameworks . . .

# lambda_function.py

from sippycup import SippyCup

app = SippyCup()


@app.route('/hello/<string:name>', methods=['GET', 'POST'])
@app.mimetype('text/plain')
def hello_world(name='World'):
    return 'Hello, {0}!'.format(name)


@app.route('/')
def index():
    """show the request as delivered from API gateway"""
    return app.request.apigr


lambda_handler = app.run