Interview Prep/AWS/Serverless & Messaging (Step Functions, EventBridge, SQS, SNS)

Lambda consumers of an SQS queue are processing the same message twice. How do you make this safe?

IntermediateScenarioServerless & Messaging (Step Functions, EventBridge, SQS, SNS)
Answer

SQS standard queues deliver at least once, and visibility timeouts can expire mid-processing. Make processing idempotent by storing a processed message or business ID in DynamoDB with a conditional write, set the visibility timeout to at least six times the function timeout, and use FIFO queues with deduplication where strict once-only is required.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on Serverless & Messaging (Step Functions, EventBridge, SQS, SNS)