如何确保 AWS 无服务器架构中数据的一次性处理?

How to ensure once-only processing of data in an AWS serverless architecture?

我有一些数据需要在某个时间点处理。

我目前的策略是每分钟拉取一次数据,加载到队列中处理。

我对这个策略有两个顾虑:

  1. 我不能保证最后一分钟捕获所有数据,所以我拉了最后两分钟;和
  2. 据我所知,Lambda 可以多次触发,具体取决于触发器(在本例中为 SQS。)

由于批处理的尖峰特性,我试图避免向数据写入标志。

我能想到的唯一其他解决方案是使用 S3 创建锁定文件。

是否有更好的方法来 'kick off' 未来的事件?是否有数据库和 S3 标志之外的策略?

看看 SQS FIFO Queues,它们被设计为只交付一次。

You can now use Amazon Simple Queue Service (SQS) for applications that require messages to be processed in a strict sequence and exactly once using First-in, First-out (FIFO) queues. FIFO queues are designed to ensure that the order in which messages are sent and received is strictly preserved and that each message is processed exactly once. ...source