← 所有文章2026.09.16 · SAA-C03 · AWS 解決方案架構師助理級

AWS Messaging 與 Serverless:先設計 Delivery Semantics

先分 queue、pub/sub、stream 與 orchestration,再串 Lambda、API Gateway 與 event-driven workload。

選 messaging service 前先回答:一個或多個 consumer、work queue 或 replayable history、是否需 ordering、能否接受 duplicate、throughput 與 retention。

需求 優先想
給 competing consumers 的工作緩衝 SQS
一個 event push 給多 subscriber SNS
Ordered、replayable event stream Kinesis Data Streams
把 buffered stream 送到 destination Data Firehose
依 rule 路由 application/SaaS/AWS event EventBridge
現有 ActiveMQ/RabbitMQ protocol Amazon MQ

SQS Standard 高 scalability、at-least-once、best-effort ordering,consumer 必須 idempotent。FIFO 在 message group 內保序並有 deduplication semantics,但有不同 throughput 限制。Visibility timeout 要大於 processing time 或動態延長;反覆失敗送 DLQ,並要有明確 redrive policy。

SNS fan-out 常送到多個獨立 SQS queue,讓每個 consumer 有自己的 buffering/retry。需 routing rule、SaaS integration、schema 或 event bus 時用 EventBridge。

Serverless 仍然有 state 與 failure

Lambda synchronous、asynchronous、poll-based invocation 的 retry 不同。Reserved concurrency 保留/限制 capacity;provisioned concurrency 降 cold start。Lambda 進 VPC 是為存取 VPC resource,不是通用 performance 優化。連 RDS 用 RDS Proxy 避免 connection storm。

API Gateway 提供 HTTP/WebSocket entry、auth、throttling 與 endpoint types。Step Functions 管 workflow state/retry/branch/compensation;SQS 管 durable work buffering。Cognito User Pool 驗證 user;Identity Pool 換 AWS credentials。

考試視角: 選 FIFO 不會單獨產生 exactly-once。Producer、broker、consumer、state change 與 retry path 都要對齊。

複習卡

  • Queue 分工;topic fan-out;stream 保留 ordered records。
  • SQS consumer 要能處理 duplicate。
  • DLQ 用於隔離與診斷,不會自動修復。
  • EventBridge route event;Step Functions 協調 workflow state。
  • 加 Lambda 前先定義 retry/idempotency。