Ever tried to make AWS Lambda talk to a Kyma Function on SAP BTP and ended up buried in docs and 400 errors? Same. In this post, I’ll walk you through the simplest setup that actually works — a Lambda sending JSON to Kyma over HTTPS, step by step.
(In the code snippets, substitute KYMA_CLUSTER_DOMAIN with your Kyma Cluster Domain.)
To recreate this setup, you only need a few free-tier tools and basic access:
Accounts & Platforms
Local Tools
First, we’ll create a function called message-function. You’ll find Functions under Namespaces → your_namespace → Functions.
Click Create, name it message-function, set the language to JavaScript and the runtime to Node.js 22. Leave the rest as default.
In the Source tab, add the following code:
module.exports = {
main: async function (event, context) {
let input;
try {
if (!event.data) {
input = {};
} else if (typeof event.data === "string") {
input = JSON.parse(event.data);
} else {
input = event.data;
}
} catch (err) {
console.error("Parse error:", err.message);
return {
statusCode: 400,
body: {
error: "Invalid JSON payload",
details: err.message
}
};
}
console.log("Received payload:", input);
return {
statusCode: 200,
body: {
message: "Hello from Kyma — message-function working!",
received: input
}
};
}
};Click Create.
Click Save and wait for the function to reach a Running state (you’ll briefly see Unknown):
It should switch to Ready after a few seconds:
Create a file named message-function-apirule.yaml with the following content and apply it:
apiVersion: gateway.kyma-project.io/v1beta1
kind: APIRule
metadata:
name: message-function
spec:
gateway: kyma-gateway.kyma-system.svc.cluster.local
host: message-function
service:
name: message-function
port: 80
rules:
- path: /.*
methods: ["GET", "POST"]
accessStrategies:
- handler: allow$ kubectl apply -f message-function-apirule.yamlYou should see:
apirule.gateway.kyma-project.io/message-function createdCheck your namespace:
$ kubectl get apirule -n devYou’ll get something like:
message-function Ready ["message-function.<KYMA_CLUSTER_DOMAIN>"]Test it again:
$ curl -X POST https://message-function.<KYMA_CLUSTER_DOMAIN> \
-H "Content-Type: application/json" \
-d '{"test":"direct"}'You should see a response like:
Hello world from the Kyma Function message-function running on Node.js 22!Now let’s work through the Lambda part.
In AWS Console → Lambda → Functions → Create Function:
Add this code to your index.mjs file:
// index.js (CommonJS)
const https = require("https");
exports.handler = async (event) => {
const data = JSON.stringify({
from: "AWS Lambda",
time: new Date().toISOString(),
echo: event || {}
});
const options = {
hostname: "message-function.<KYMA_CLUSTER_DOMAIN>",
port: 443,
path: "/",
method: "POST",
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(data)
}
};
return new Promise((resolve, reject) => {
const req = https.request(options, (res) => {
let body = "";
res.on("data", (chunk) => (body += chunk));
res.on("end", () => {
console.log("Kyma replied:", body);
resolve({ statusCode: res.statusCode, body });
});
});
req.on("error", (err) => {
console.error("HTTPS error:", err);
reject(err);
});
req.write(data);
req.end();
});
};Create a test event with the JSON: { "hello": "world" }
Click Test (top right corner). You should see:
Then click the Logs link to open CloudWatch:
Open the latest log stream and you’ll see something like:
And we’re golden!
2025-10-17T07:24:39.081Z 141aa77f-cbdd-4c28-b74a-d56c18519d3e INFO Kyma replied: Hello world from the Kyma Function message-function running on Node.js 22!Conclusion:
With just a Kyma Function, an APIRule, and a few lines of Node.js in AWS Lambda, we’ve built a working integration between AWS and SAP BTP. The Lambda sends a simple JSON payload over HTTPS, Kyma processes it, and responds in real time. The result is lightweight, reliable, and scalable — perfect for triggering SAP workloads from AWS events without extra middleware or services.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |