Deploy Node.js SDK in AWS Lambda
This page provides information on how to deploy Node.js SDK code in AWS Lambda services.
Before you begin
Use similar Node.js SDK code as in the JavaScript SDK example.
AWS Lambda supports Node 10.x runtime (as of writing).
Make sure your environment uses Node 10.x or compatible version.
Step-by-step Guide
Create your Node.js project
Add an
index.jsfile with the following content. Replace the placeholdersSDK API KEY,USER ID, andSPLIT NAMEwith your actual values:const SplitFactory = require('@splitsoftware/splitio').SplitFactory; const factory = SplitFactory({ core: { authorizationKey: 'SDK API KEY' }, startup: { readyTimeout: 10 }, scheduler: { impressionsRefreshRate: 1, eventsPushRate: 2, }, debug: true }); exports.handler = async (event) => { const client = factory.client(); try { await client.whenReady(); } catch (error) { console.log("SDK_READY_TIMED_OUT event emitted. Treatments will be control"); } const treatment = client.getTreatment("USER ID", "SPLIT NAME"); console.log("\ntreatment: " + treatment); return treatment; };Install the SDK dependency
Run this command at your project root to install the Node.js SDK package:
npm install --save @splitsoftware/splitio@10.16.0Prepare deployment package
Zip the
index.jsfile and thenode_modulesfolder intofunction.zip.Create your Lambda function

Login to AWS Console
Go to Lambda → Functions
Click Create function
Choose Author from scratch
Select Node.js 10.x runtime
Give your function a name
Click Create function
Configure Lambda function settings

Under Basic settings, set Memory (e.g., 256 MB)
Set Timeout (e.g., 1 minute)
Upload your deployment package
Using the AWS CLI, upload your zipped package:
aws lambda update-function-code --function-name YOUR_FUNCTION_NAME --zip-file fileb://function.zipConfigure test event

In the Lambda console, select Configure test events
Use the Hello World template
Provide necessary event key-value data (if needed)
Save the test event
Test your Lambda function

Click Test
The expected output should be the treatment value
Logs will show any additional debug information
This example demonstrates how to run the Split Node.js SDK within AWS Lambda and retrieve feature flag treatments programmatically.
Last updated
Was this helpful?