AWS SQS FIFO Queue: The queue should either have ContentBasedDeduplication enabled or MessageDeduplicationId provided explicitly?

Viewed 12866

When I try to add a message to my FIFO SQS using AWS CLI I get:

An error occurred (InvalidParameterValue) when calling the SendMessage operation: The queue should either have ContentBasedDeduplication enabled or MessageDeduplicationId provided explicitly

My Request:

C:\Windows\system32>aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/307125934878/myqueue.fifo --message-body "hello world" --region us-east-1 --message-group-id 3

How can I solve this?

1 Answers

You have to provide --message-deduplication-id or enable ContentBasedDeduplication for your queue:

You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message).

The deduplication ID is:

the token used for deduplication of sent messages. If a message with a particular message deduplication ID is sent successfully, any messages sent with the same message deduplication ID are accepted successfully but aren't delivered during the 5-minute deduplication interval.

For the existing queue, you can enable it in its Configuration options:

enter image description here

Related