Serverless Tip #7: Idempotency is especially important in distributed serverless architectures
Distributed systems fail. We need to design for such failures upfront and make our applications fault-tolerant.
Many integrations on AWS, such as SQS standard queues, have an at-least-once delivery mechanism. Your Lambda functions might receive the same event more than once.
If that is an order event, you must refrain from fulfilling the order or charging your customers twice.
To guard against this, ensure that your functions are idempotent. With idempotency, you can detect repeated events and prevent duplicate actions.
Most Lambda Powertools libraries include tooling for implementing idempotency in your language of choice.