> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/examples/nodejs-sdk-aws-lambda.md).

# 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 <a href="#before-you-begin" id="before-you-begin"></a>

* Use similar Node.js SDK code as in the [JavaScript SDK example](https://github.com/Split-Community/Split-SDKs-Examples/blob/main/Javascript-SDK/README.md).
* 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 <a href="#step-by-step-guide" id="step-by-step-guide"></a>

1. **Create your Node.js project**

   Add an `index.js` file with the following content. Replace the placeholders `SDK API KEY`, `USER ID`, and `SPLIT NAME` with your actual values:

   ```js
   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;
   };
   ```
2. **Install the SDK dependency**

   Run this command at your project root to install the Node.js SDK package:

   ```bash
   npm install --save @splitsoftware/splitio@10.16.0
   ```
3. **Prepare deployment package**

   Zip the `index.js` file and the `node_modules` folder into `function.zip`.
4. **Create your Lambda function**

   ![](/files/xP3RSOfzYDK1e4YU9kTa)

   * 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**
5. **Configure Lambda function settings**

   ![](/files/aaRbMs7ZluQjjTpjBXP3)

   * Under **Basic settings**, set Memory (e.g., 256 MB)
   * Set Timeout (e.g., 1 minute)
6. **Upload your deployment package**

   Using the AWS CLI, upload your zipped package:

   ```bash
   aws lambda update-function-code --function-name YOUR_FUNCTION_NAME --zip-file fileb://function.zip
   ```
7. **Configure test event**

   ![](/files/FLzHzayOjBfDt4v8yiCh)

   * 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
8. **Test your Lambda function**

   ![](/files/UIv5aJthEpbgyoB791BF)

   * 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.
