|
1 | 1 | # AWS Lambda Function URL Emulator
|
2 | 2 |
|
3 |
| -This repository provides a lightweight Docker image to emulate **AWS Lambda Function URLs** locally. It uses **AWS Lambda Runtime Interface Emulator (RIE)** to replicate the behavior of Function URLs for local development and testing. |
| 3 | +A lightweight Docker image to emulate **AWS Lambda Function URLs** locally. It works with [AWS Lambda Runtime Interface Emulator (RIE)](https://github.com/aws/aws-lambda-runtime-interface-emulator/) to replicate the behavior of Function URLs for local development and testing. |
4 | 4 |
|
5 | 5 | ## Features
|
6 | 6 |
|
7 | 7 | - Emulates **AWS Lambda Function URLs** locally.
|
8 |
| -- Automatically forwards HTTP requests to a locally running Lambda function using the AWS Lambda Runtime Interface Emulator. |
| 8 | +- Automatically forwards HTTP requests to a locally running Lambda function to work with the AWS Lambda Runtime Interface Emulator. |
9 | 9 | - Supports `APIGatewayProxyEventV2` for HTTP API requests.
|
10 | 10 | - Handles `isBase64Encoded` for binary data.
|
11 | 11 |
|
12 | 12 | ## Getting Started
|
13 | 13 |
|
14 |
| -### Pull the Docker Image |
| 14 | +### Run with Docker (Standalone) |
15 | 15 |
|
16 |
| -```bash |
17 |
| -docker pull daido1976/aws-lambda-function-url-emulator:latest |
18 |
| -``` |
19 |
| - |
20 |
| -### Run the Emulator |
| 16 | +Please ensure that RIE is running in a separate container beforehand. |
21 | 17 |
|
22 | 18 | ```bash
|
23 | 19 | docker run --rm -p 8080:8080 \
|
24 | 20 | -e RIE_ENDPOINT=http://host.docker.internal:9000/2015-03-31/functions/function/invocations \
|
25 | 21 | daido1976/aws-lambda-function-url-emulator:latest
|
26 | 22 | ```
|
27 | 23 |
|
28 |
| -The emulator will be available at `http://localhost:8080`. |
| 24 | +The emulator will be available at `http://localhost:8080` and forwards requests to the RIE endpoint. |
29 | 25 |
|
30 |
| -### Use Docker Compose to work with RIE |
| 26 | +### Run with Docker Compose |
31 | 27 |
|
32 | 28 | For a practical example of integrating this emulator with RIE using Docker Compose, refer to the [example](./example/) directory.
|
33 | 29 |
|
34 |
| -## Environment Variables |
| 30 | +### Run as a CLI Tool (Go) |
35 | 31 |
|
36 |
| -| Variable | Description | Default Value | |
37 |
| -| -------------- | --------------------------------------------------- | ----------------------------------------------------------------- | |
38 |
| -| `RIE_ENDPOINT` | URL for the Lambda Runtime Interface Emulator (RIE) | `http://localhost:9000/2015-03-31/functions/function/invocations` | |
| 32 | +Install the emulator as a CLI tool: |
39 | 33 |
|
40 |
| -## Build the Docker Image Locally |
| 34 | +```bash |
| 35 | +go install github.com/daido1976/aws-lambda-function-url-emulator@latest |
| 36 | +``` |
41 | 37 |
|
42 |
| -If you want to build the Docker image yourself: |
| 38 | +Run it with: |
43 | 39 |
|
44 | 40 | ```bash
|
45 |
| -docker build -t aws-lambda-function-url-emulator . |
| 41 | +aws-lambda-function-url-emulator |
46 | 42 | ```
|
47 | 43 |
|
| 44 | +The 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: |
| 45 | + |
| 46 | +```bash |
| 47 | +RIE_ENDPOINT=http://custom-host:9000/2015-03-31/functions/function/invocations aws-lambda-function-url-emulator |
| 48 | +``` |
| 49 | + |
| 50 | +## Environment Variables |
| 51 | + |
| 52 | +| Variable | Description | Default Value | |
| 53 | +| -------------- | --------------------------------------------------- | ----------------------------------------------------------------- | |
| 54 | +| `RIE_ENDPOINT` | URL for the Lambda Runtime Interface Emulator (RIE) | `http://localhost:9000/2015-03-31/functions/function/invocations` | |
| 55 | + |
48 | 56 | ## License
|
49 | 57 |
|
50 | 58 | This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
|
0 commit comments