Skip to main content

AWS Lambda handler that proxies events to a configurable HTTP endpoint

Project description

aws-event-proxy

An AWS Lambda handler that proxies events to a configurable HTTP endpoint.

Forwards events from any AWS source (SQS, SNS, S3, DynamoDB Streams, etc.) to an external HTTP endpoint via POST, including Lambda execution context in the request headers.

Installation

pip install aws-event-proxy

Configuration

Set the PROXY_TARGET_URL environment variable in your Lambda function to the URL you want events forwarded to.

Usage

Set your Lambda handler to:

aws_event_proxy.handler

What it does

  • POSTs the raw Lambda event as JSON to PROXY_TARGET_URL
  • Attaches Lambda context metadata as the X-Lambda-Context request header
  • Returns the parsed JSON response body from the target
  • Logs proxy activity and re-raises errors to the Lambda runtime

Packaging for Lambda deployment

import aws_event_proxy

zip_bytes = aws_event_proxy.get_handler_zip()

get_handler_zip() returns the zip file as bytes, ready to upload to Lambda via the AWS SDK or write to disk:

# Write to disk
with open("aws-event-proxy-lambda.zip", "wb") as f:
    f.write(aws_event_proxy.get_handler_zip())

# Upload directly with boto3
import boto3
boto3.client("lambda").update_function_code(
    FunctionName="my-function",
    ZipFile=aws_event_proxy.get_handler_zip(),
)

Set the Lambda handler to aws_event_proxy.handler.

Development

make setup          # install dependencies and create .venv
poetry run pytest   # run tests

Publishing

poetry publish --build

Project details


Download files

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

Source Distribution

aws_event_proxy-0.2.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_event_proxy-0.2.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file aws_event_proxy-0.2.0.tar.gz.

File metadata

  • Download URL: aws_event_proxy-0.2.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for aws_event_proxy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15d989674d07f2388e18d78a85e994265d5f3afdf7070becf277adfeb1e1869e
MD5 96902bea44495d2b142657858d61c951
BLAKE2b-256 c4cd56132b3a084e282a90a8c6b443c4605cc0cf3a0a86baf7d1168bd4348ca7

See more details on using hashes here.

File details

Details for the file aws_event_proxy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: aws_event_proxy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for aws_event_proxy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d997f8f65e16bdc48603adb611ebb30e11ef0b4d5a74905b78eeed8b34459a6f
MD5 bff53bd078d7de9cb3ecd08a4dcfe181
BLAKE2b-256 56494bc0bd8cba8af528d11e3484d068830dbc830ba4c6fe2da723ca4998a1ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page