欢迎使用 FlowZap,快速、清晰、掌控的绘图应用。

无服务器事件处理架构

Architecture

无服务器事件处理架构图,S3、DynamoDB Streams、API Gateway 和 CloudWatch 触发器调用 Lambda 函数,由 Step Functions 编排,通过 SQS 扇出并使用死信队列进行错误处理。该模板展示如何完全从托管无服务器组件构建复杂的事件处理管道,无需配置或管理任何服务器。适合需要弹性扩展和内置容错能力的数据处理工作流。

完整 FlowZap 代码

EventSources { # Event Sources
n1: rectangle label:"S3 Bucket Upload"
n2: rectangle label:"DynamoDB Stream"
n3: rectangle label:"API Gateway Webhook"
n4: rectangle label:"CloudWatch Scheduled Rule"
n1.handle(bottom) -> Triggers.n5.handle(top) [label="ObjectCreated"]
n2.handle(bottom) -> Triggers.n6.handle(top) [label="StreamRecord"]
n3.handle(bottom) -> Triggers.n7.handle(top) [label="POST Event"]
n4.handle(bottom) -> Triggers.n8.handle(top) [label="Cron"]
}
Triggers { # Lambda Triggers
n5: rectangle label:"Image Processing Lambda"
n6: rectangle label:"Data Sync Lambda"
n7: rectangle label:"Webhook Handler Lambda"
n8: rectangle label:"Batch Job Lambda"
n5.handle(bottom) -> Processing.n9.handle(top) [label="Process Image"]
n6.handle(bottom) -> Processing.n11.handle(top) [label="Sync Data"]
n7.handle(bottom) -> Processing.n9.handle(top) [label="Handle Event"]
n8.handle(bottom) -> Processing.n12.handle(top) [label="Run Batch"]
}
Processing { # Processing Pipeline
n9: rectangle label:"Step Functions Orchestrator"
n10: diamond label:"Processing Complete?"
n11: rectangle label:"Transform and Load"
n12: rectangle label:"Fan-Out with SQS"
n13: rectangle label:"Error Handler Lambda"
n9.handle(right) -> n10.handle(left)
n10.handle(right) -> n11.handle(left) [label="Success"]
n10.handle(bottom) -> n13.handle(top) [label="Failure"]
n12.handle(right) -> n11.handle(left) [label="Parallel"]
n13.handle(bottom) -> Storage.n17.handle(top) [label="DLQ"]
n11.handle(bottom) -> Storage.n14.handle(top) [label="Store"]
}
Storage { # Managed Storage
n14: rectangle label:"DynamoDB Table"
n15: rectangle label:"S3 Results Bucket"
n16: rectangle label:"SNS Notification Topic"
n17: rectangle label:"SQS Dead Letter Queue"
n14.handle(right) -> n15.handle(left) [label="Archive"]
n15.handle(right) -> n16.handle(left) [label="Notify"]
}

为什么需要这个工作流?

Building event processing pipelines on traditional servers requires provisioning for peak load, managing scaling policies, and handling server failures. Serverless event processing automatically scales per-event, handles failures with built-in DLQ support, and costs nothing when idle—perfect for bursty, unpredictable workloads.

工作原理

  1. Step 1: Events from S3 uploads, DynamoDB streams, API webhooks, and scheduled rules trigger Lambda functions.
  2. Step 2: Each trigger type invokes a specialized Lambda function for its processing logic.
  3. Step 3: Step Functions orchestrate multi-step processing with branching and parallel execution.
  4. Step 4: SQS provides fan-out for parallel processing of independent work items.
  5. Step 5: Failed events are captured in a dead letter queue for investigation.
  6. Step 6: Processed results are stored in DynamoDB and S3, with SNS notifications for downstream consumers.

替代方案

Container-based event processors (ECS) offer more control over runtime but require capacity management. Managed services like AWS EventBridge simplify routing. This template shows the fully serverless event processing pipeline.

Key Facts

Template Name无服务器事件处理架构
CategoryArchitecture
Steps6 workflow steps
FormatFlowZap Code (.fz file)

相关模板

无服务器 API 后端架构

Architecture

无服务器 API 后端架构图,展示 API 网关、Lambda 授权函数、业务逻辑函数以及包括 DynamoDB、S3、SQS 和 SNS 在内的托管云服务,实现完全托管、自动扩展的后端。该模板模拟无服务器优先方法,完全消除基础设施管理,按调用付费并自动缩放至零。对于构建经济高效的事件驱动 API 后端的初创公司和团队至关重要。

无服务器 Step Functions 编排架构

Architecture

AWS Step Functions 编排架构图,展示状态机工作流,包括选择状态、并行处理、等待回调模式以及失败步骤的补偿回滚。该模板模拟无服务器工作流编排,复杂的多步骤流程定义为具有内置错误处理和重试逻辑的状态机。对于构建需要人工审批或长时间运行流程的可靠无服务器工作流的团队至关重要。

微服务 API 网关架构

Architecture

微服务 API 网关架构图,展示请求路由、JWT 身份验证、速率限制、服务发现以及跨分布式后端服务的响应聚合。该模板模拟微服务生态系统中所有客户端流量的入口点,在请求到达内部服务之前执行安全策略。适合设计具有集中式横切关注点的可扩展 API 基础设施的平台工程师。

微服务服务网格架构

Architecture

服务网格架构图,展示 Istio 或 Linkerd 边车代理处理 mTLS 加密、流量策略、熔断器和跨微服务的分布式追踪。该模板可视化服务网格如何将网络关注点从应用代码中抽象出来,实现服务间的零信任通信。对于采用服务网格基础设施以提升可观测性和安全性的团队至关重要。

微服务每服务独立数据库架构

Architecture

每服务独立数据库架构图,每个微服务拥有其专用数据存储,通过 Kafka 进行事件驱动同步以实现跨服务数据一致性。该模板展示了微服务数据隔离的核心原则,展示 PostgreSQL 和 MongoDB 如何在多语言持久化策略中共存。对于在保持最终一致性的同时强制服务自治的架构师至关重要。

按业务能力分解微服务架构

Architecture

按业务能力组织的微服务分解架构图:身份认证、产品目录、定价和订单履行,每个都有独立的数据存储和 API。该模板展示如何将单体应用拆分为与业务领域对齐的服务,使用 Backend-for-Frontend (BFF) 模式进行客户端特定的聚合。适合规划领域驱动微服务边界的架构师。

返回所有模板