From 9c7faa066eaf8a31e06b0f3ff7dfb40ebf3645b8 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 2 Jan 2025 10:57:28 +0100 Subject: [PATCH] Create appsync-lambda-bedrock-async-stream-subscription-cdk.json add pattern json file --- ...bedrock-async-stream-subscription-cdk.json | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 appsync-lambda-bedrock-async-stream-subscription-cdk/appsync-lambda-bedrock-async-stream-subscription-cdk.json diff --git a/appsync-lambda-bedrock-async-stream-subscription-cdk/appsync-lambda-bedrock-async-stream-subscription-cdk.json b/appsync-lambda-bedrock-async-stream-subscription-cdk/appsync-lambda-bedrock-async-stream-subscription-cdk.json new file mode 100644 index 000000000..26cec414c --- /dev/null +++ b/appsync-lambda-bedrock-async-stream-subscription-cdk/appsync-lambda-bedrock-async-stream-subscription-cdk.json @@ -0,0 +1,81 @@ +{ + "title": "Amazon Bedrock calls via AppSync & Lambda streaming for long tasks", + "language": "TypeScript", + "level": "300", + "framework": "CDK", + "introBox": { + "headline": "How it works", + "text": [ + "The pattern implements an asynchronous streaming architecture.", + "Client initiates a WebSocket subscription and makes a request to AWS AppSync. AppSync invokes Lambda function in event mode, enabling asynchronous processing.", + "Lambda function streams responses from Amazon Bedrock using ConverseStream. Lambda function sends updates via mutations to AppSync. Updates are delivered to client through WebSocket subscription." + ] + }, + "gitHub": { + "template": { + "repoURL": "https://github.com/aws-samples/serverless-patterns/tree/main/appsync-lambda-bedrock-async-stream-subscription-cdk", + "templateURL": "serverless-patterns/appsync-lambda-bedrock-async-stream-subscription-cdk", + "projectFolder": "appsync-lambda-bedrock-async-stream-subscription-cdk", + "templateFile": "/lib/appsync-lambda-bedrock-async-stream-subscription-cdk-stack.ts" + } + }, + "resources": { + "bullets": [ + { + "text": "AWS AppSync JavaScript resolver and function reference for Amazon Bedrock runtime", + "link": "https://docs.aws.amazon.com/appsync/latest/devguide/resolver-reference-bedrock-js.html#long-running-invocations" + }, + { + "text": "Bedrock ConverseStream API", + "link": "https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html" + } + ] + }, + "deploy": { + "text": ["cdk deploy"] + }, + "testing": { + "text": ["See the GitHub repo for detailed testing instructions."] + }, + "cleanup": { + "text": ["Delete the stack: cdk destroy --all."] + }, + "authors": [ + { + "name": "Kaustav Dey", + "image": "https://avatars.githubusercontent.com/u/13236519", + "bio": "Solution Architect at AWS", + "linkedin": "kaustavbecs" + } + ], + "patternArch": { + "icon1": { + "x": 20, + "y": 50, + "service": "appsync", + "label": "AWS AppSync" + }, + "icon2": { + "x": 50, + "y": 50, + "service": "lambda", + "label": "AWS Lambda" + }, + "icon3": { + "x": 80, + "y": 50, + "service": "bedrock", + "label": "Amazon Bedrock" + }, + "line1": { + "from": "icon1", + "to": "icon2", + "label": "" + }, + "line2": { + "from": "icon2", + "to": "icon3", + "label": "" + } + } +}