Sign inSign up

outofcoffee/lambdahttpgw

By outofcoffee

•Updated 6 months ago

Image
0

2.9K

outofcoffee/lambdahttpgw repository overview

⁠Lambda HTTP Gateway

Simple HTTP gateway for AWS Lambda. Acts as a lightweight API gateway for AWS Lambda functions.

⁠Run

Important: Ensure the relevant AWS credentials are configured before run. The gateway uses the standard AWS mechanisms to authenticate/authorise with the AWS Lambda API, so the usual approaches of profiles/credentials apply.

docker run -it -p 8090:8090 outofcoffee/lambdahttpgw

Note: the home directory for the gateway user that runs the binary is /opt/gateway

⁠Call Lambda function

Call the Lambda function via the gateway:

curl http://localhost:8090/MyLambdaName/some/path
...
<Lambda HTTP response>

Note the prefix of the Lambda function name (MyLambdaName above), before the path. The function receives the portion of the path without the function name, i.e. /some/path in this example.

The Lambda function receives events in the standard AWS API Gateway JSON format, and is expected to respond in kind.

⁠Configuration

Environment variables:

VariableMeaningDefaultExample
AWS_REGIONAWS region in which to connect to Lambda functions.eu-west-1us-east-1
LOG_LEVELLog level (trace, debug, info, warn, error).debugwarn
PORTPort on which to listen.80908080
REQUEST_ID_HEADERName of request header to use as request ID for logging. If absent, a UUID will be used.Emptyx-correlation-id
STATS_REPORT_INTERVALThe frequency with which stats should be reported, if enabled.5s2m
STATS_REPORT_URLURL to which stats should be reported. If not empty, hits are recorded for each function name.Emptyhttps://example.com

Tag summary

Content type

Image

Digest

sha256:7026cff37…

Size

34.5 MB

Last updated

6 months ago

docker pull outofcoffee/lambdahttpgw