Skip to content

New pattern submission - sam-dotnet-responsestreaming-bedrock #3233

Description

@dougperkes

New Pattern Submission — sam-dotnet-responsestreaming-bedrock

Pattern Details

  • Title: Lambda Response Streaming with Amazon Bedrock — Story Generator (.NET)
  • Description: Stream LLM-generated story text token-by-token from Amazon Bedrock through Lambda response streaming and API Gateway to the client.
  • Language: .NET (C#)
  • Framework: SAM
  • Level: 200
  • Services: AWS Lambda, Amazon API Gateway, Amazon Bedrock

How It Works

This pattern deploys a Lambda function that invokes Amazon Bedrock (Claude Sonnet) via the ConverseStream API and pipes generated tokens directly through API Gateway response streaming to the client.

The user specifies a genre, setting, and theme via query parameters, and the story appears word-by-word in the terminal. First tokens arrive within seconds — no waiting for the full generation to complete.

This demonstrates end-to-end streaming from Bedrock through Lambda to the client using the .NET response streaming SDK (LambdaResponseStreamFactory.CreateHttpStream).

GitHub PR for template:

Author

  • Name: Doug Perkes
  • Bio: Senior Solutions Architect at AWS, focused on .NET and serverless.
  • LinkedIn: dougperkes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions