[{"data":1,"prerenderedAt":70},["ShallowReactive",2],{"pattern-apigw-lambda-bedrock-cdk-python":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":13,"deploy":15,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":6,"introBox":27,"language":34,"level":35,"meta":36,"patternArch":37,"resources":56,"s3URL":6,"services":6,"stem":64,"testing":65,"videoId":6,"__hash__":69},"patterns\u002Fpatterns\u002Fapigw-lambda-bedrock-cdk-python.json","Amazon API Gateway - AWS Lambda - Amazon Bedrock",null,{"headline":8,"text":9},"Cleanup",[10,11,12],"1. Delete the stack: \u003Ccode>npx cdk destroy\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>.","3. You see a message confirming DELETE_COMPLETE.",[14],"content\u002Fcontributors\u002Fguillermo-mansilla.json",{"text":16},[17],"cdk deploy","Interact with Bedrock models from a Lambda function fronted with an API Gateway","json","AWS CDK",{"template":22},{"repoURL":23,"templateURL":24,"projectFolder":25,"templateFile":26},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-lambda-bedrock-cdk-python","serverless-patterns\u002Fapigw-lambda-bedrock-cdk-python","apigw-lambda-bedrock-cdk-python","apigw_lambda_bedrock\u002Fapigw_lambda_bedrock_stack.py",{"headline":28,"text":29},"How it works",[30,31,32,33],"This project builds an integration between Amazon API Gateway, AWS Lambda, and Amazon Bedrock","The core functionality revolves around exposing an API endpoint via API Gateway that accepts a user-defined prompt.","When a prompt is received, the API Gateway triggers an AWS Lambda function. This Lambda function is responsible for invoking a model (anthropic.claude-v2 for now, but can be extended to include others) hosted on Amazon Bedrock.","To ensure compatibility with Bedrock, a Lambda Layer is utilized, it contains the latest version of the Boto3 library, as only the most recent Boto3 version includes a client for Amazon Bedrock.","Python","200",{},{"icon1":38,"icon2":43,"icon3":46,"line1":50,"line2":54},{"x":39,"y":40,"service":41,"label":42},20,50,"apigw","Amazon API Gateway",{"x":40,"y":40,"service":44,"label":45},"lambda","AWS Lambda",{"x":47,"y":40,"service":48,"label":49},80,"bedrock","Amazon Bedrock",{"from":51,"to":52,"label":53},"icon1","icon2","",{"from":52,"to":55,"label":53},"icon3",{"bullets":57},[58,61],{"text":59,"link":60},"Amazon Bedrock API Reference","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock\u002Flatest\u002FAPIReference\u002Fwelcome.html",{"text":62,"link":63},"Packaging custom boto3 version as a layer","https:\u002F\u002Frepost.aws\u002Fknowledge-center\u002Flambda-python-runtime-errors","patterns\u002Fapigw-lambda-bedrock-cdk-python",{"headline":66,"text":67},"Testing",[68],"See the GitHub repo for detailed testing instructions.","SnVDaVeX18gYJLLNvUJ4qNwzc2ZSE_eX44enFPlpM-s",1781087766092]