---
title: "AWS TypeScript LangServe example"
description: "A minimal Langserve AWS TypeScript Pulumi program"
url: "https://www.pulumi.com/dev/examples/aws-ts-langserve/"
image: "https://www.pulumi.com/assets/og/dev/examples/aws-ts-langserve.png"
---

# AWS TypeScript LangServe example

A minimal Langserve AWS TypeScript Pulumi program

- Source on GitHub: https://github.com/pulumi/examples/tree/master/aws-ts-langserve
- Deploy with Pulumi: https://app.pulumi.com/new?template=https%3A%2F%2Fgithub.com%2Fpulumi%2Fexamples%2Ftree%2Fmaster%2Faws-ts-langserve

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/aws-ts-langserve) repo. Pull down just this directory to follow along:

```bash
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set aws-ts-langserve
cd pulumi-examples/aws-ts-langserve
```

This example demonstrates how to deploy a simple LangServe app using Pulumi in TypeScript.

## Prerequisites

1. [Install Pulumi](https://www.pulumi.com/docs/get-started/install/)
1. [Configure AWS credentials](https://www.pulumi.com/docs/intro/cloud-providers/aws/setup/)
1. [Install Node.js](https://www.pulumi.com/docs/intro/languages/javascript/)
1. [Install Docker](https://docs.docker.com/get-docker/)
1. [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
1. [Install the LangChain CLI](https://python.langchain.com/docs/langserve#installation)

## Deploying the example

1.  Create a new stack:

    ```bash
    pulumi stack init dev
    ```

1.  Set the AWS region to deploy into:

    ```bash
    pulumi config set aws:region us-west-2
    ```

1.  Set your OpenAI API key:

    ```bash
    pulumi config set open-api-key --secret # Enter your OpenAI API key
    ```

1.  Install dependencies:

    ```bash
    npm install
    ```

1.  Deploy the stack. This will show you a preview of the resources that will be created. After reviewing the changes, you will be prompted to continue.

    ```bash
    pulumi up
    ```

    The whole deployment process will take a couple of minutes. Once it's done, you will see the URL of your LangServe app in the output.

    ```
    Outputs:
        url: "http://<dns>.elb.amazonaws.com"

    Resources:
        + 27 created
    ```

    You can now access the LangServe playground by adding `/openai/playground` to the URL you got from the output.

    > [!NOTE]
    > It may take a few minutes for the load balancer to be ready to accept requests. If you see a 503 error, wait a few minutes and try again.

## Cleaning up

To clean up the resources created by this example, run:

```bash
pulumi destroy
pulumi stack rm
```
