Response streaming with Amazon API Gateway Rest API and AWS Lambda

API Gateway REST API → AWS Lambda → Amazon Bedrock

Creates an API Gateway REST API and Python Lambda function that provides a streaming response from the LLMs in Amazon Bedrock.

This pattern demonstrates how to use an Amazon API Gateway REST API with response streaming to a AWS Lambda Python function.
To enable response streaming with a Lambda Python function, we use Lambda Web Adapter and Fast API.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-rest-api-lambda-python-response-streaming

Deploy

sam deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Created by:

Yusuf Mayet

Yusuf Mayet

I am a Solutions Architect at AWS, where I help customers realise that true transformation lies at the intersection of Cloud, DevOps cultural practices, Agile principles, modular and scalable architectures, and efficient team structures.

Follow on LinkedIn