[PYTHON] AWS SNS delivers duplicate messages

I often touch AWS.

I was a little addicted to AWS SNS.

problem

For some reason, the message was successfully sent from AWS SNS via lambda, but duplicate messages are sent.

In the first place, it seemed to be duplicated from SNS to lambda.

Setting `` `numRetries``` to 0 in the delivery retry policy does not help.

image.png

Solution

I had to send a success status in a response message when I finished processing with lambda. (The following is python, but other languages are the same)

## In a lambda function

def main()

    ...

    return {
        'statusCode': 200
    }

This will eliminate duplicate delivery.

Recommended Posts

AWS SNS delivers duplicate messages
[aws] Send and receive sqs messages