Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefansundin/go-lambda-gateway
Run Go lambda functions that use API Gateway locally.
https://github.com/stefansundin/go-lambda-gateway
api-gateway aws aws-lambda golang
Last synced: 19 days ago
JSON representation
Run Go lambda functions that use API Gateway locally.
- Host: GitHub
- URL: https://github.com/stefansundin/go-lambda-gateway
- Owner: stefansundin
- Created: 2018-10-22T02:26:57.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-02T22:07:59.000Z (2 months ago)
- Last Synced: 2024-10-11T00:54:45.503Z (about 1 month ago)
- Topics: api-gateway, aws, aws-lambda, golang
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 13
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This program is a tiny Amazon API Gateway emulator, letting you invoke Go AWS Lambda functions (running locally) over HTTP. At the moment, it proxies all requests to a single function.
I'm sure there are bugs, and it's not very customizable. If you have use cases that aren't covered yet, feel free to submit pull requests!
You need to set `_LAMBDA_SERVER_PORT` when running your lambda to make it listen for requests on a port.
This project supports the HTTP API payload format, but you need to set `PAYLOAD_FORMAT_VERSION=2.0` to use it. See [examples/http-api](examples/http-api) and [the documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html).
Docker image available: https://hub.docker.com/r/stefansundin/go-lambda-gateway
You can also use the program without using Docker:
```shell
go install github.com/stefansundin/go-lambda-gateway@latest
```If you put a TLS certificate (`.crt`) and its key (`.key`) in the current working directory then the program will automatically use them.
Note: Beware of the capitalization of your headers. This program uses Go's `net/http` server, which will normalize the capitalization of your headers according to its own `CanonicalHeaderKey` function, whereas Amazon API Gateway does not manipulate the capitalization at all (but if you send the same header multiple times with different capitalization, it will use the first capitalization).
You may also be interested in [go-lambda-invoke](https://github.com/stefansundin/go-lambda-invoke).