Requirement Summary:
Orders are being processed more than once
Need to prevent duplicate processing
Looking for least implementation effort
Key Concept:
Lambda + Event-driven patterns can occasionally result in duplicate invocations (at-least-once delivery model)
You need idempotency (i.e., prevent repeated processing of same event)
Evaluate Options:
A. Use DynamoDB for de-duplication
Simple and widely used approach
Store a unique orderId as the primary key
Before processing, check if order exists
If yes → skip
If no → process and store the ID
Minimal code changes required
B. ECS + Step Functions
Overkill for basic de-duplication
Adds significant complexity
C. Retry logic with fixed delay
Doesn ' t prevent duplication — makes it worse
Retrying might trigger the same message again
D. Athena to identify duplicates
Reactive solution, not preventative
Not suitable for real-time event de-duplication
Lambda idempotency: https://docs.aws.amazon.com/lambda/latest/dg/invocation-retries.html
Using DynamoDB for idempotent design: https://aws.amazon.com/blogs/compute/how-to-design-idempotent-APIs-on-aws/