aws / aws-lambda-runtime-interface-emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add environment variable for --runtime-interface-emulator-address

shaicoleman opened this issue · comments

At the moment it's not possible to configure the runtime interface emulator address without patching the docker image.

The default is 0.0.0.0:8080 , and I would like to restrict it to the local network for security reasons.

Hi. There is already a parameter that you can pass called --runtime-interface-emulator-address

(Definition and Example usage in the tests)

Is this what you're looking for?

The lambda-entrypoint.sh looks like this (taken from public.ecr.aws/lambda/ruby:3.3-x86_64):

#!/bin/sh
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

if [ $# -ne 1 ]; then
  echo "entrypoint requires the handler name to be the first argument" 1>&2
  exit 142
fi
export _HANDLER="$1"

RUNTIME_ENTRYPOINT=/var/runtime/bootstrap
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
  exec /usr/local/bin/aws-lambda-rie $RUNTIME_ENTRYPOINT
else
  exec $RUNTIME_ENTRYPOINT
fi

The command line parameters passed to aws-lambda-rie are hard coded, so there's no easy way to adjust those parameters. At the moment I need to create a docker image with a patched lambda-entrypoint.sh which is a lot more work than setting an environment variable.

Ok. I understand what's the use case now.

If you want to make a contribution, we would be happy to review and merge. It should be something similar to how the logLevel is handled that can be passed as a parameter or as an env var: https://github.com/aws/aws-lambda-runtime-interface-emulator/blob/develop/cmd/aws-lambda-rie/main.go#L44-L48 (plus tests)

In any case, we'll take this into consideration and see when we can take this.