Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shaicoleman opened this issue Apr 15, 2024 · 5 comments
Open

Comments

@shaicoleman
Copy link

shaicoleman commented Apr 15, 2024

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.

@valerena
Copy link
Contributor

valerena commented May 2, 2024

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?

@shaicoleman
Copy link
Author

shaicoleman commented May 2, 2024

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.

@valerena
Copy link
Contributor

valerena commented May 2, 2024

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.

@shaicoleman
Copy link
Author

@valerena , could you look into adding it?

@valerena
Copy link
Contributor

valerena commented Aug 1, 2024

Hi @shaicoleman. I don't have enough bandwidth to submit the changes myself at the moment, but I could help reviewing code if you want to send a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants