Are your AWS Lambdas doing things twice? Here is how to fix it. Today, my SQS queue delivered duplicate messages, and my Lambda function sent two emails to the same user. My initial code checked if a lock existed before writing it, but a classic "Race Condition" bypassed it. The Fix: Use attribute_not_exists in DynamoDB. Python import botocore email_lock_key = f"email_report_{today}_{user_id}" try