|
| 1 | +{ |
| 2 | + "title": "Stream Amazon Bedrock responses with Amazon API Gateway", |
| 3 | + "description": "Stream LLM responses from Amazon Bedrock through Amazon API Gateway REST API using AWS Lambda response streaming for real-time AI chat experiences.", |
| 4 | + "language": "TypeScript", |
| 5 | + "level": "300", |
| 6 | + "framework": "AWS CDK", |
| 7 | + "introBox": { |
| 8 | + "headline": "How it works", |
| 9 | + "text": [ |
| 10 | + "This pattern deploys an Amazon API Gateway REST API with response streaming enabled, backed by an AWS Lambda function that streams responses from Amazon Bedrock (Claude) in real-time using Server-Sent Events (SSE).", |
| 11 | + "When a client sends a prompt, API Gateway forwards it to a streaming Lambda function. The function invokes Amazon Bedrock and progressively writes each text chunk to the response stream. The client receives tokens as they are generated, dramatically reducing time-to-first-byte.", |
| 12 | + "This pattern is ideal for building AI chatbots, copilots, and interactive assistants where real-time streaming improves user experience." |
| 13 | + ] |
| 14 | + }, |
| 15 | + "gitHub": { |
| 16 | + "template": { |
| 17 | + "repoURL": "https://github.com/aws-samples/serverless-patterns/tree/main/apigw-streaming-lambda-bedrock-cdk", |
| 18 | + "templateURL": "serverless-patterns/apigw-streaming-lambda-bedrock-cdk", |
| 19 | + "projectFolder": "apigw-streaming-lambda-bedrock-cdk", |
| 20 | + "templateFile": "lib/apigw-streaming-lambda-bedrock-stack.ts" |
| 21 | + } |
| 22 | + }, |
| 23 | + "resources": { |
| 24 | + "bullets": [ |
| 25 | + { |
| 26 | + "text": "Building responsive APIs with Amazon API Gateway response streaming", |
| 27 | + "link": "https://aws.amazon.com/blogs/compute/building-responsive-apis-with-amazon-api-gateway-response-streaming/" |
| 28 | + }, |
| 29 | + { |
| 30 | + "text": "Serverless strategies for streaming LLM responses", |
| 31 | + "link": "https://aws.amazon.com/blogs/compute/serverless-strategies-for-streaming-llm-responses/" |
| 32 | + }, |
| 33 | + { |
| 34 | + "text": "Amazon Bedrock", |
| 35 | + "link": "https://aws.amazon.com/bedrock/" |
| 36 | + } |
| 37 | + ] |
| 38 | + }, |
| 39 | + "patternArch": { |
| 40 | + "icon1": { |
| 41 | + "x": 20, |
| 42 | + "y": 50, |
| 43 | + "service": "apigw", |
| 44 | + "label": "API Gateway REST API" |
| 45 | + }, |
| 46 | + "icon2": { |
| 47 | + "x": 50, |
| 48 | + "y": 50, |
| 49 | + "service": "lambda", |
| 50 | + "label": "Lambda (Streaming)" |
| 51 | + }, |
| 52 | + "icon3": { |
| 53 | + "x": 80, |
| 54 | + "y": 50, |
| 55 | + "service": "bedrock", |
| 56 | + "label": "Bedrock (Claude)" |
| 57 | + }, |
| 58 | + "line1": { |
| 59 | + "from": "icon1", |
| 60 | + "to": "icon2" |
| 61 | + }, |
| 62 | + "line2": { |
| 63 | + "from": "icon2", |
| 64 | + "to": "icon3" |
| 65 | + } |
| 66 | + }, |
| 67 | + "deploy": { |
| 68 | + "text": [ |
| 69 | + "cdk deploy" |
| 70 | + ] |
| 71 | + }, |
| 72 | + "testing": { |
| 73 | + "text": [ |
| 74 | + "See the GitHub repo for detailed testing instructions." |
| 75 | + ] |
| 76 | + }, |
| 77 | + "cleanup": { |
| 78 | + "text": [ |
| 79 | + "Delete the stack: <code>cdk destroy</code>." |
| 80 | + ] |
| 81 | + }, |
| 82 | + "authors": [ |
| 83 | + { |
| 84 | + "name": "Nithin Chandran R", |
| 85 | + "bio": "Technical Account Manager at AWS", |
| 86 | + "linkedin": "nithin-chandran-r" |
| 87 | + } |
| 88 | + ] |
| 89 | +} |
0 commit comments