A lightweight Docker image to emulate AWS Lambda Function URLs locally. It works with AWS Lambda Runtime Interface Emulator (RIE) to replicate the behavior of Function URLs for local development and testing.
- Emulates AWS Lambda Function URLs locally.
- Automatically forwards HTTP requests to a locally running Lambda function to work with the AWS Lambda Runtime Interface Emulator.
- Supports
APIGatewayProxyEventV2for HTTP API requests. - Handles
isBase64Encodedfor binary data. - Supports enabling CORS via an environment variable, allowing cross-origin requests.
Please ensure that RIE is running in a separate container beforehand.
docker run --rm -p 8080:8080 \
-e RIE_ENDPOINT=http://host.docker.internal:9000/2015-03-31/functions/function/invocations \
daido1976/aws-lambda-function-url-emulator:latestThe emulator will be available at http://localhost:8080 and forwards requests to the RIE endpoint.
For a practical example of integrating this emulator with RIE using Docker Compose, refer to the example directory.
Install the emulator as a CLI tool:
go install github.com/daido1976/aws-lambda-function-url-emulator@latestRun it with:
aws-lambda-function-url-emulatorThe emulator will be available at http://localhost:8080 and forwards requests to the default RIE endpoint. To use a custom endpoint, set the RIE_ENDPOINT environment variable:
RIE_ENDPOINT=http://custom-host:9000/2015-03-31/functions/function/invocations aws-lambda-function-url-emulator| Variable | Description | Default Value |
|---|---|---|
RIE_ENDPOINT |
URL for the Lambda Runtime Interface Emulator (RIE) | http://localhost:9000/2015-03-31/functions/function/invocations |
ENABLE_CORS |
Set this to true to enable CORS for all origins, methods, and headers.Warning: Please be aware that this options may have security implications. |
false |
This project is licensed under the MIT License. See the LICENSE file for details.