Skip to content

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

Open
@shaicoleman

Description

@shaicoleman

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.

Activity

valerena

valerena commented on May 2, 2024

@valerena
Contributor

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

shaicoleman commented on May 2, 2024

@shaicoleman
Author

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

valerena commented on May 2, 2024

@valerena
Contributor

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

shaicoleman commented on Jul 23, 2024

@shaicoleman
Author

@valerena , could you look into adding it?

valerena

valerena commented on Aug 1, 2024

@valerena
Contributor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @shaicoleman@valerena

        Issue actions

          Add environment variable for --runtime-interface-emulator-address · Issue #120 · aws/aws-lambda-runtime-interface-emulator