site-logo

JAWS PANKRATION 2024

Deep Dive into Lambda Response Streaming

Lv300

Lv300

8/24/2024 21:40 (UTC)

Session Info

As we celebrate the 10th anniversary of AWS Lambda, I would like to delve into the intricacies of Lambda Response Streaming.

Despite its seemingly simple description, implementing this feature can be quite confusing. Having developed a Lambda Response Streaming handler for the web framework "Hono,"

I will clarify the complexities and share practical insights from my experience.

Yohei  Watanabe

Yohei Watanabe

- AWS Community Builders -

- AWS Top Engineers(APN) -

- AWS Ambassadors(APN) -

- AWS All Certified Engineers(APN) -



Session Category
Computing, Developer tools


AWS Services



Session Summary (by Amazon Bedrock)
    The speaker discusses streaming technology, particularly in the context of AWS Lambda, which is celebrating its 10th anniversary. Streaming, introduced in 2022, has gained attention for handling large data transfers and rapid text delivery. Key points: 1. Response Streaming: Allows quick return of data as it becomes available, supporting up to 20MB of data transfer. 2. Implementation: Uses SSE (Server-Sent Events) but not WebSockets. Payload size limit is 20MB for streaming compared to 6MB for normal responses. 3. Configuration: Set input mode to "response_stream" in Lambda settings. CDK import options are available. 4. Constraints: Minimum data size threshold for streaming, requires managed runtime or custom runtime. 5. Usage: Wrap functions with @aws_lambda_powertools_python decorator. Writing to stream using pipe is recommended. 6. Custom metadata: Use aws_lambda_streaming.from_handler() for defining custom status keys. 7. Runtime communication: Lambda functions communicate with Runtime API for event handling and response delivery. 8. Implementation details: Add specific information to API calls, use chunks, and explicitly close connections. 9. Frameworks: Common web frameworks can be used with some adaptations. 10. Container runtime: Supports extensions like FastAPI without special configurations. 11. Setup: Attach layers to functions, specify wrapper and custom runtime settings. The speaker encourages users to try streaming technology and refers to available resources and implementations for further guidance.

©JAWS-UG (AWS User Group - Japan). All rights reserved.