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

Dynamically resolve Amazon Lambda arch #39914

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

ARCHITECTURE=$(arch)
JAVA_MAJOR_VERSION_NUM=$(echo 'var rt_version = Runtime.class.getMethod("version"); var version = rt_version.invoke(null); System.out.println(rt_version.getReturnType().getMethod("major").invoke(version))' | jshell -)
LAMBDA_NATIVE_RUNTIME="provided.al2023" # The current runtimes available are available within AWS lambda documentation

function cmd_create() {
echo Creating function
set -x
Expand All @@ -11,6 +15,7 @@ function cmd_create() {
--role ${LAMBDA_ROLE_ARN} \
--timeout 15 \
--memory-size 256 \
--architectures "${ARCHITECTURE}" \
${LAMBDA_META}
# Enable and move this param above ${LAMBDA_META}, if using AWS X-Ray
# --tracing-config Mode=Active \
Expand Down Expand Up @@ -51,7 +56,7 @@ function cmd_update() {

FUNCTION_NAME=${lambdaName}
HANDLER=${handler}
RUNTIME=java17
RUNTIME=java${JAVA_MAJOR_VERSION_NUM}
ZIP_FILE=${targetUri}

function usage() {
Expand All @@ -70,7 +75,7 @@ fi

if [ "$1" == "native" ]
then
RUNTIME=provided
RUNTIME=${LAMBDA_NATIVE_RUNTIME}
ZIP_FILE=${targetUri}
FUNCTION_NAME=${lambdaName}Native
LAMBDA_META="--environment Variables={DISABLE_SIGNAL_HANDLERS=true}"
Expand Down