{"id":37157669,"url":"https://github.com/localstack/lambda-runtime-init","last_synced_at":"2026-01-14T18:49:00.483Z","repository":{"id":65982072,"uuid":"468707499","full_name":"localstack/lambda-runtime-init","owner":"localstack","description":"LocalStack customizations for the AWS Lambda Runtime Interface Emulator","archived":false,"fork":true,"pushed_at":"2025-12-15T15:04:13.000Z","size":25027,"stargazers_count":7,"open_issues_count":11,"forks_count":2,"subscribers_count":0,"default_branch":"localstack","last_synced_at":"2025-12-18T08:10:37.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.localstack.cloud/aws/services/lambda/#localstack-lambda-runtime-interface-emulator-rie","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"aws/aws-lambda-runtime-interface-emulator","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-03-11T10:34:06.000Z","updated_at":"2025-12-15T15:02:29.000Z","dependencies_parsed_at":"2023-02-19T19:45:36.590Z","dependency_job_id":null,"html_url":"https://github.com/localstack/lambda-runtime-init","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"purl":"pkg:github/localstack/lambda-runtime-init","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flambda-runtime-init","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flambda-runtime-init/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flambda-runtime-init/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flambda-runtime-init/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack","download_url":"https://codeload.github.com/localstack/lambda-runtime-init/tar.gz/refs/heads/localstack","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flambda-runtime-init/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T18:48:59.757Z","updated_at":"2026-01-14T18:49:00.477Z","avatar_url":"https://github.com/localstack.png","language":"Go","readme":"## AWS Lambda Runtime Interface Emulator\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/aws/aws-lambda-runtime-interface-emulator)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/aws/aws-lambda-runtime-interface-emulator)\n![GitHub](https://img.shields.io/github/license/aws/aws-lambda-runtime-interface-emulator)\n\n\nThe Lambda Runtime Interface Emulator is a proxy for Lambda’s Runtime and Extensions APIs, which allows customers to\nlocally test their Lambda function packaged as a container image. It is a lightweight web-server that converts\nHTTP requests to JSON events and maintains functional parity with the Lambda Runtime API in the cloud. It\nallows you to locally test your functions using familiar tools such as cURL and the Docker CLI (when testing\nfunctions packaged as container images). It also simplifies running your application on additional computes.\nYou can include the Lambda Runtime Interface Emulator in your container image to have it accept HTTP\nrequests instead of the JSON events required for deployment to Lambda. This component does not emulate\nLambda’s orchestrator, or security and authentication configurations. You can get started by downloading and installing it on your local machine. When the Lambda Runtime API emulator is executed, a `/2015-03-31/functions/function/invocations` endpoint will be stood up within the container that you post data to it in order to invoke your function for testing.\n\n\n## Content\n* [Installing](#installing)\n* [Getting started](#getting-started)\n  * [Test an image with RIE included in the image](#test-an-image-with-rie-included-in-the-image)\n    * [To test your Lambda function with the emulator](#to-test-your-lambda-function-with-the-emulator)\n  * [Build RIE into your base image](#build-rie-into-your-base-image)\n    * [To build the emulator into your image](#to-build-the-emulator-into-your-image)\n  * [Test an image without adding RIE to the image](#test-an-image-without-adding-rie-to-the-image)\n    * [To test an image without adding RIE to the image](#to-test-an-image-without-adding-rie-to-the-image)\n* [How to configure](#how-to-configure)\n* [Level of support](#level-of-support)\n* [Security](#security)\n* [License](#license)\n\n\n## Installing\n\nThe following commands download the RIE binary for your platform. Note that while you can download the binary on any platform, the RIE can only be executed in a Linux environment (typically within a Docker container).\n\n| Platform (for downloading) | Command to download |\n|---------|---------\n| macOS/Linux x86\\_64 | `mkdir -p ~/.aws-lambda-rie \u0026\u0026 curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \u0026\u0026 chmod +x ~/.aws-lambda-rie/aws-lambda-rie` |\n| macOS/Linux arm64 | `mkdir -p ~/.aws-lambda-rie \u0026\u0026 curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 \u0026\u0026 chmod +x ~/.aws-lambda-rie/aws-lambda-rie` |\n| Windows x86\\_64 | `Invoke-WebRequest -OutFile 'C:\\Program Files\\aws lambda\\aws-lambda-rie' https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie` |\n| Windows arm64 | `Invoke-WebRequest -OutFile 'C:\\Program Files\\aws lambda\\aws-lambda-rie' https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64` |\n\nAfter downloading, the RIE binary must be used within a Linux environment, typically as part of a Docker container setup. See the Docker configuration instructions below for proper implementation.\n\n## Getting started\n\nThere are a few ways you use the Runtime Interface Emulator (RIE) to locally test your function depending on the base image used.\n\n\n### Test an image with RIE included in the image\n\nThe AWS base images for Lambda include the runtime interface emulator. You can also follow these steps if you built the RIE into your alternative base image.\n\n#### To test your Lambda function with the emulator\n\n1. Build your image locally using the docker build command.\n\n    `docker build -t myfunction:latest .`\n\n2. Run your container image locally using the docker run command.\n\n    `docker run -p 9000:8080  myfunction:latest`\n\n    This command runs the image as a container and starts up an endpoint locally at `localhost:9000/2015-03-31/functions/function/invocations`.\n\n3. Post an event to the following endpoint using a curl command:\n\n    `curl -XPOST \"http://localhost:9000/2015-03-31/functions/function/invocations\" -d '{}'`\n\n    This command invokes the function running in the container image and returns a response.\n\n### Build RIE into your base image\n\nYou can build RIE into a base image. Download the RIE from GitHub to your local machine and update your Dockerfile to install RIE.\n\n#### To build the emulator into your image\n\n1. Create a script and save it in your project directory. Set execution permissions for the script file.\n\n    The script checks for the presence of the `AWS_LAMBDA_RUNTIME_API` environment variable, which indicates the presence of the runtime API. If the runtime API is present, the script runs [the runtime interface client](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-api-client). Otherwise, the script runs the runtime interface emulator.\n\n    The following example shows a typical script for a Node.js function.\n\n    ```sh\n    #!/bin/sh\n    if [ -z \"${AWS_LAMBDA_RUNTIME_API}\" ]; then\n      exec /usr/local/bin/aws-lambda-rie /usr/bin/npx aws-lambda-ric\n    else\n      exec /usr/bin/npx aws-lambda-ric\n    fi\n    ```\n\n2. Download the [runtime interface emulator](https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest) for your target architecture (`aws-lambda-rie` for x86\\_64 or `aws-lambda-rie-arm64` for arm64) from GitHub into your project directory.\n\n3. Install the emulator package and change `ENTRYPOINT` to run the new script by adding the following lines to your Dockerfile:\n\n    To use the default x86\\_64 architecture\n\n    ```dockerfile\n    ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie\n    ENTRYPOINT [ \"/entry_script.sh\" ]\n    ```\n\n    To use the arm64 architecture:\n\n    ```dockerfile\n    ADD aws-lambda-rie-arm64 /usr/local/bin/aws-lambda-rie\n    ENTRYPOINT [ \"/entry_script.sh\" ]\n    ```\n\n4. Build your image locally using the docker build command.\n\n    ```sh\n    docker build -t myfunction:latest .\n    ```\n\n5. Run your image locally using the docker run command.\n\n    ```sh\n    docker run -p 9000:8080 myfunction:latest\n    ```\n\n### Test an image without adding RIE to the image\n\nYou install the runtime interface emulator to your local machine. When you run the container image, you set the entry point to be the emulator.\n\n#### To test an image without adding RIE to the image\n\n1. From your project directory, run the following command to download the RIE (x86-64 architecture) from GitHub and install it on your local machine.\n\n    ```sh\n    mkdir -p ~/.aws-lambda-rie \u0026\u0026 curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \\\n    https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \\\n    \u0026\u0026 chmod +x ~/.aws-lambda-rie/aws-lambda-rie\n    ```\n\n    To download the RIE for arm64 architecture, use the previous command with a different GitHub download url.\n\n    ```\n    https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 \\\n    ```\n\n2. Run your Lambda image function using the docker run command.\n\n    ```sh\n    docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest \\\n        --entrypoint /aws-lambda/aws-lambda-rie  \u003cimage entrypoint\u003e \u003c(optional) image command\u003e\n    ```\n\n    This runs the image as a container and starts up an endpoint locally at `localhost:9000/2015-03-31/functions/function/invocations`.\n\n3. Post an event to the following endpoint using a curl command:\n\n    ```sh\n    curl -XPOST \"http://localhost:9000/2015-03-31/functions/function/invocations\" -d '{}'\n    ```\n\n    This command invokes the function running in the container image and returns a response.\n\n## How to configure\n\n`aws-lambda-rie` can be configured through Environment Variables within the local running Image.\nYou can configure your credentials by setting:\n* `AWS_ACCESS_KEY_ID`\n* `AWS_SECRET_ACCESS_KEY`\n* `AWS_SESSION_TOKEN`\n* `AWS_REGION`\n\nYou can configure timeout by setting `AWS_LAMBDA_FUNCTION_TIMEOUT` to the number of seconds you want your function to timeout in.\n\nThe rest of these Environment Variables can be set to match AWS Lambda's environment but are not required.\n* `AWS_LAMBDA_FUNCTION_VERSION`\n* `AWS_LAMBDA_FUNCTION_NAME`\n* `AWS_LAMBDA_FUNCTION_MEMORY_SIZE`\n\n## Level of support\n\nYou can use the emulator to test if your function code is compatible with the Lambda environment, executes successfully\nand provides the expected output. For example, you can mock test events from different event sources. You can also use\nit to test extensions and agents built into the container image against the Lambda Extensions API. This component\ndoes _not_ emulate the orchestration behavior of AWS Lambda. For example, Lambda has a network and security\nconfigurations that will not be emulated by this component.\n\n* You can use the emulator to test if your function code is compatible with the Lambda environment, runs successfully and provides the expected output.\n* You can also use it to test extensions and agents built into the container image against the Lambda Extensions API.\n* This component does _not_ emulate Lambda’s orchestration, or security and authentication configurations.\n* The component does _not_ support X-ray and other Lambda integrations locally.\n* The component supports only Linux, for x86-64 and arm64 architectures.\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Flambda-runtime-init","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack%2Flambda-runtime-init","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Flambda-runtime-init/lists"}