To stream Amazon Bedrock output through AWS Lambda, call a Bedrock streaming operation, enable Lambda response streaming in the handler, and send each chunk onward as it arrives. If API Gateway is the HTTP front door, use a REST API proxy integration in STREAM mode and follow its response framing format. First confirm that your chosen model supports streaming; support and the appropriate Bedrock operation depend on the model interface.
Choose the Bedrock streaming operation for your model
For models that support the message interface, ConverseStream provides a consistent, message-oriented request pattern. For a model-specific interface, use InvokeModelWithResponseStream. AWS recommends calling GetFoundationModel and checking responseStreamingSupported to verify capability before building around streaming.
Use an AWS SDK or another supported client for the Bedrock streaming request: the AWS CLI does not support Bedrock streaming operations. The permission for ConverseStream includes bedrock:InvokeModelWithResponseStream; the exact resource scope depends on the model or inference profile and your deployment.
Enable response streaming in the Lambda handler
Returning a conventional Lambda response object follows a buffered response path. AWS’s Node.js streaming pattern instead wraps the handler with awslambda.streamifyResponse() and writes generated output to the response stream as it becomes available. Once generation is complete, end the stream gracefully so the client can recognize that no more data is coming.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match#1 Best Overall
The application flow is: Lambda makes the Bedrock streaming request, reads its returned events or chunks, and writes the relevant output to its Lambda response stream. The client-facing protocol and any transformation of Bedrock chunks are application decisions; streaming does not by itself guarantee a particular token cadence or latency.
Choose how the client reaches Lambda
| Path | Configuration and invocation | Use it when |
|---|---|---|
| Direct Lambda response streaming, such as through a Lambda function URL | Use a stream-enabled handler and a client path that supports Lambda response streaming. The API Gateway transfer-mode configuration below does not apply. | You do not need API Gateway’s REST API features or its proxy response framing. |
| API Gateway REST API proxy | Configure an AWS_PROXY or HTTP_PROXY integration with response transfer mode STREAM. For Lambda proxy integration, API Gateway invokes the function with InvokeWithResponseStream. |
You want API Gateway as the HTTP front door and can use its documented streaming proxy behavior. |
These are distinct deployment paths, not universally ranked alternatives. Choose based on the client protocol and the rest of your deployment. AWS describes lower time to first byte for generative AI chatbots as a use case for API Gateway response streaming, not as a guaranteed performance improvement for an individual application.
Rank #2
Configure API Gateway response streaming
AWS documents this response-streaming mode for API Gateway REST APIs with proxy integrations. The integration response transfer mode defaults to BUFFERED; change it to STREAM to stream the response. This is not available for HTTP APIs, and it enables response streaming only: API Gateway request streaming is unsupported in this mode.
API Gateway’s Lambda response stream has a specific format: JSON metadata first, then a delimiter, then the raw payload chunks. AWS provides awslambda.HttpResponseStream.from() to write the metadata wrapper without manually constructing the delimiter. If you emit the framing yourself, the delimiter is eight null bytes and must appear within the first 16 KB of the response stream.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #3
Use the helper for metadata framing
When using AWS’s documented helper, pass the response metadata through awslambda.HttpResponseStream.from() and write the payload to the resulting stream. This avoids hand-building the delimiter. Ensure your Lambda handler is stream-enabled as well; setting API Gateway’s transfer mode alone does not convert a buffered handler response into an application-level stream.
Emit framing manually only when needed
If your implementation writes the framing directly, place the JSON metadata at the beginning, write exactly eight null bytes as the delimiter, and then write the raw payload. The delimiter must occur within the first 16 KB. Incorrect framing can prevent API Gateway or the client from interpreting the response as intended.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Account for duration and endpoint timeouts
AWS documents a maximum API Gateway response-stream duration of 15 minutes. Its idle timeout depends on the REST API endpoint type:
| Endpoint type | Idle timeout |
|---|---|
| Regional or private | Five minutes |
| Edge-optimized | 30 seconds |
Plan for the relevant idle limit as well as the overall duration: an otherwise valid generation that leaves the response idle too long can still exceed the endpoint’s constraint. These are AWS service limits, not a target token rate or a latency guarantee.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
Check permissions and invocation configuration
There is no single least-privilege policy that can be specified without knowing the account, model, and inference-profile choices. Verify the required permissions against the resources used in your deployment rather than copying a generic policy.
- Allow the Lambda execution role to make the selected Bedrock streaming call. For
ConverseStream, AWS identifiesbedrock:InvokeModelWithResponseStreamas the required permission. - Ensure the caller can invoke Lambda where applicable; AWS identifies
lambda:InvokeFunctionfor Lambda invocation. - For API Gateway, allow the API integration to invoke the Lambda function.
- Scope model and inference-profile resources to match the specific deployment.
Keep this separate from Bedrock Agents action groups
This pattern is application-level response streaming: Lambda calls Bedrock and streams generated output toward a client. Amazon Bedrock Agents’ Lambda action-group integration is a separate contract and is not the mechanism described here.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




