Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

jantman/webhook2lambda2sqs

Repository files navigation

webhook2lambda2sqs

pypi version

PyPi downloads

GitHub Forks

GitHub Open Issues

travis-ci for master branch

coverage report for master branch

sphinx documentation for latest release

Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired.

Generate code and manage infrastructure for receiving webhooks with AWS API Gateway and pushing to SQS via Lambda.

Deprecated and Unsupported

This project is now deprecated; I'll provide support as possible, but I don't use it myself anymore. This was originally written in July 2016, and targeted Terraform 0.6 or 0.7. There have been a lot of changes to both Terraform and API Gateway since then, and the combination of these changes make this project obsolete.

Most importantly, API Gateway now supports proxy integrations with Lambda, allowing API Gateway to pass through all methods on all paths of an API to Lambda. Using the Python runtime, this results in the Lambda function essentially being passed all of the HTTP request information (path, URL parameters, body, headers, etc.) and then being able to return a dictionary specifying the HTTP response code, body and headers.

Recent versions of Terraform also have much better support for sequence and mapping types (lists and dicts) as well as some rudimentary support for iteration and conditionals. However, with the Lambda proxy/pass-through functionality of API Gateway, it's now possible to do everything this project aims to do with native terraform for the API Gateway and Lambda, and configuration completely on the Lambda side.

I'll update this README if I ever write a Terraform module to replace this (I haven't had need yet), but the short version is, this project can now be completely replaced by a native Terraform module.

Introduction

Webhooks are great, and many projects and services are now offering them as a notification option. But sometimes it makes more sense to have the messages in a queue that can absorb changes in rate and de-couple the sending service from a potentially slow or unavailable backend.

webhook2lambda2sqs generates code for an AWS Lambda function to receive webhook content via API Gateway and push it to an SQS queue, where it can be consumed as needed. It supports multiple endpoints via unique URL paths (API Gateway resources), where content sent to each endpoint is pushed to one or more SQS queues.

In addition, webhook2lambda2sqs includes a wrapper around HashiCorp Terraform to automate creation and maintenance of all or part of the infrastructure required to operate this (the API Gateway and its configuration, the Lambda function, the function's IAM role, etc.). If TerraForm isn't a viable option for you to manage infrastructure with, you can use the generated configuration (which maps quite closely to AWS API parameters) as a guide for manual management.

There are also helper commands to view the Lambda Function and API Gateway logs, send a test message, and view the queue contents.

For full documentation, see: http://webhook2lambda2sqs.readthedocs.io/en/latest/

Requirements

  • An Amazon AWS account to run this all in (note - it will probably be cheap, but not free)
  • Python 2.7 or 3.4+ (currently tested with 2.7, 3.4, 3.5, 3.6).
  • Python VirtualEnv and pip (recommended installation method; your OS/distribution should have packages for these)
  • HashiCorp Terraform >= 0.6.16 to manage the AWS infrastructure, if desired. Terraform is written in Go, and distributed as a static binary.

Program Components

  • Lambda Function code generation
  • Terraform configuration generation
  • Management of infrastructure via Terraform
  • AWS-related helpers for inspecting queues and logs, querying information, and enabling metrics/logging/rate limiting on the API Gateway.

Full Documentation

For full documentation, see: http://webhook2lambda2sqs.readthedocs.io/en/latest/

Bugs and Feature Requests

Bug reports and feature requests are happily accepted via the GitHub Issue Tracker. Pull requests are welcome. Issues that don't have an accompanying pull request will be worked on as my time and priority allows.

A Note About the License

This program is licensed under the GNU Affero General Public License, version 3.0 or later ("AGPLv3"). The AGPLv3 includes a clause that source code must be made available to anyone using the program over a network.

About

ABANDONED - Generate code and manage infrastructure for receiving webhooks with AWS API Gateway and pushing to SQS via Lambda.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages