Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

AWS C# LangServe example

A minimal Langserve AWS C# Pulumi program

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set aws-cs-langserve
cd pulumi-examples/aws-cs-langserve

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

Prerequisites#

  1. Install Pulumi
  2. Configure AWS credentials
  3. Install .NET
  4. Install Docker
  5. Install the AWS CLI
  6. Install the LangChain CLI

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init dev
  2. Set the AWS region to deploy into:

    Terminal window
    pulumi config set aws:region us-east-1
  3. Set your OpenAI API key:

    Terminal window
    pulumi config set open-api-key --secret
  4. Deploy the stack:

    Terminal window
    pulumi up

    This 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 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#

Once you’re finished experimenting, you can destroy your stack and remove it to avoid incurring any additional cost:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.