
Build AWS Lambda handlers across managed and custom runtimes; supports native bootstrap executables, buffered/native response modes, and CommonJS-compatible handler exports.
Kotlin Multiplatform library for AWS Lambda. Targets: jvm, js (Node.js), linuxX64, linuxArm64, macosArm64. The runtime module has no js target: the Node.js Lambda runtime polls for events itself.
Build a Linux executable and start the custom runtime from main:
// build.gradle.kts
kotlin {
linuxArm64 {
binaries.executable {
entryPoint = "com.example.main"
baseName = "bootstrap"
// platform.posix links libcrypt.so.1, which the provided.al2023 runtime lacks.
linkerOpts("-Wl,--as-needed")
}
}
}fun main() = LambdaNativeRuntime.BufferedResponse(MyHandler()).start()Deploy the resulting bootstrap.kexe as bootstrap on the provided.al2023 runtime.
Export a function that delegates to your handler and deploy the compiled output on a nodejs runtime, with <module>.handler as the handler:
// build.gradle.kts
kotlin {
js {
nodejs()
binaries.library()
useCommonJs()
}
}@JsExport
fun handler(event: Any?, context: NodeLambdaContext): Promise<Any?> = MyHandler.handleNode(event, context)Blocking handlers return the result directly instead of a Promise.
Kotlin Multiplatform library for AWS Lambda. Targets: jvm, js (Node.js), linuxX64, linuxArm64, macosArm64. The runtime module has no js target: the Node.js Lambda runtime polls for events itself.
Build a Linux executable and start the custom runtime from main:
// build.gradle.kts
kotlin {
linuxArm64 {
binaries.executable {
entryPoint = "com.example.main"
baseName = "bootstrap"
// platform.posix links libcrypt.so.1, which the provided.al2023 runtime lacks.
linkerOpts("-Wl,--as-needed")
}
}
}fun main() = LambdaNativeRuntime.BufferedResponse(MyHandler()).start()Deploy the resulting bootstrap.kexe as bootstrap on the provided.al2023 runtime.
Export a function that delegates to your handler and deploy the compiled output on a nodejs runtime, with <module>.handler as the handler:
// build.gradle.kts
kotlin {
js {
nodejs()
binaries.library()
useCommonJs()
}
}@JsExport
fun handler(event: Any?, context: NodeLambdaContext): Promise<Any?> = MyHandler.handleNode(event, context)Blocking handlers return the result directly instead of a Promise.