You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Amazon SNS与Lambda限流场景下重试机制的交互疑问

SNS与Lambda限流场景下的重试行为解析

Great question—this is a common point of confusion when combining SNS message delivery with Lambda's throttling handling. Let's break down exactly what happens in this scenario, based on AWS's documented behaviors:

核心机制区分

First, it's critical to understand that SNS's retry mechanism and Lambda's async throttling retry mechanism are completely independent, with separate triggers and scopes:

  • SNS's retry kicks in when it receives a failure response from Lambda (like 429, 5xx, function errors, or timeouts). It follows the 50-attempt, 13+ hour retry cycle you outlined.
  • Lambda's built-in async retry only applies when you directly invoke Lambda using the Event (async) invocation type (e.g., via the aws lambda invoke --invocation-type Event CLI command). This 6-hour retry cycle does NOT apply to invocations triggered by event sources like SNS.

当Lambda触发限流且新SNS消息到达时的行为

Let's walk through the exact sequence:

  1. First message triggers throttling: When SNS tries to deliver a message to Lambda and gets a 429 Too Many Requests (throttle) response, SNS will NOT treat Lambda as "available"—instead, it adds this message to its own retry queue and follows its standard 50-attempt retry schedule.
  2. Lambda's own retry doesn't activate here: Since this invocation is initiated by SNS (an event source), Lambda's built-in async throttling retry won't take over. Lambda returns the 429 directly to SNS, and the responsibility for retrying falls entirely to SNS.
  3. New incoming SNS messages: When a new message arrives, SNS will attempt to deliver it immediately, regardless of existing throttling events. If Lambda is still throttled, this new message will also trigger SNS's retry workflow—each message is handled independently in SNS's retry system.

关键结论

  • SNS will never hand off retry responsibility to Lambda for messages it's delivering. The two systems don't coordinate their retry logic.
  • Lambda's 6-hour async retry only applies to direct async invocations you initiate, not event-source triggered invocations like SNS.
  • Every SNS message that hits a Lambda throttle will go through SNS's full 50-attempt retry cycle unless it's successfully delivered or expires.

内容的提问来源于stack exchange,提问作者mordowiciel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:23:01