1. Packages
  2. AWS Classic
  3. How-to Guides
  4. AWS JavaScript LangServe Example

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

AWS JavaScript LangServe Example

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

    View Code

    This example demonstrates how to use deploy a simple app using Pulumi in JavaScript.

    Prerequisites

    To run this example, you’ll need the following tools installed on your machine:

    1. Install Node.js
    2. Install Pulumi
    3. Configure AWS
    4. Install Docker
    5. Install the AWS CLI
    6. Install the LangChain CLI

    Deploying to AWS using Pulumi

    Run the following command to deploy your LangServe app to AWS:

    git clone https://github.com/pulumi/examples.git
    cd examples/aws-js-langserve
    pulumi stack init <your-stack-name>
    pulumi install
    pulumi config set open-api-key --secret # Enter your OpenAI API key
    pulumi up
    

    This last command will show you a preview of the resources that will be created. After reviewing the changes, you will be prompted to continue. Once confirmed, Pulumi will deploy your LangServe app to AWS.

    The whole deployoment 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.

    Clean up

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

    pulumi destroy
    

    You will be prompted to confirm the deletion of the resources. Once confirmed, Pulumi will delete all the resources created by this example.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi