Skip to content

Enabled ARM support #8

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

Merged
merged 1 commit into from
Mar 7, 2025
Merged

Enabled ARM support #8

merged 1 commit into from
Mar 7, 2025

Conversation

zfz7
Copy link
Contributor

@zfz7 zfz7 commented Feb 18, 2025

Hey,

I wanted to add support for the ARM runtime. I updated the LambdaPackagerTask plugin to add support for a architecture param. You can configure the the buildLambdaRelease task like:

buildLambdaRelease {
    architecture.set(Architecture.LINUX_X64) // or Architecture.LINUX_ARM64
}

Testing X86

./gradlew clean buildLambdaRelease // built with x86 

aws lambda create-function --function-name Kotlin-Native \ 
--handler sample.kexe --zip-file fileb:///Users/daniel/workspace/kotlin-native-aws-lambda-runtime/sample/build/lambda/release/sample.zip  \ 
--runtime provided.al2 \
--architecture x86_64 \
--role arn:aws:iam::<AWS_ACC>:role/<ROLE_NAME \
--tracing-config Mode=Active

aws lambda invoke --cli-binary-format raw-in-base64-out --function-name Kotlin-Native --payload '{"command": "Say Hi!"}' output.json 

cat output.json
{
                 "statusCode": 200,
                 "headers": {
                   "Content-Type": "application/json"
                 },
                 "isBase64Encoded": false,
                 "body": "Hello world"
             }

Testing ARM

./gradlew clean buildArmLambda // built with ARM by updating build.gradle.kts in sample project

aws lambda create-function --function-name Kotlin-Native \ 
--handler sample.kexe --zip-file fileb:///Users/daniel/workspace/kotlin-native-aws-lambda-runtime/sample/build/lambda/release/sample.zip  \ 
--runtime provided.al2 \
--architecture arm64 \
--role arn:aws:iam::<AWS_ACC>:role/<ROLE_NAME \
--tracing-config Mode=Active

aws lambda invoke --cli-binary-format raw-in-base64-out --function-name Kotlin-Native --payload '{"command": "Say Hi!"}' output.json 

cat output.json
{
                 "statusCode": 200,
                 "headers": {
                   "Content-Type": "application/json"
                 },
                 "isBase64Encoded": false,
                 "body": "Hello world"
             }

Question

  • I would love to add a bundleLibcrypt param or runtime param that will pull the libcrypt.so.1 into the zip file, but wasn't sure if thats possible / something you would want to do.

@trueangle
Copy link
Owner

Thanks for the effort @zfz7.
However, this is only true for macOS machine builds. Arm64 arch build fails on a Linux machine as Kotlin repo misses necessary dependencies. I will mention this limitation in the docs.

@trueangle trueangle merged commit 5654cc9 into trueangle:master Mar 7, 2025
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

Successfully merging this pull request may close these issues.

2 participants