Skip to content

Instantly share code, notes, and snippets.

@janjaali
Last active March 27, 2023 15:22
Show Gist options
  • Save janjaali/64c4843758bb46d0e6e5482575307c95 to your computer and use it in GitHub Desktop.
Save janjaali/64c4843758bb46d0e6e5482575307c95 to your computer and use it in GitHub Desktop.
Little cheatsheet for AWS CLI SQS commands

Create a FIFO queue

aws --endpoint http://localhost:9324 sqs create-queue --queue-name queue-name.fifo --attributes FifoQueue=true,MessageRetentionPeriod=1209600,ContentBasedDeduplication=false
  • MessageRetentionPeriod is set to 1209600 seconds which equals to 14 days

Send a message (file) to queue

aws --endpoint-url http://localhost:19324 sqs send-message --queue-url http://localhost:19324/queue/queue-name --message-body file://./message.json

Send a message to FIFO queue

aws --endpoint http://localhost:9324 sqs send-message --queue-url http://localhost:9324/queue/queue-name.fifo --message-body "body" --message-group-id "messageGroupId" --message-deduplication-id "messageDeduplicationId"

Send batch of messages to FIFO queue

aws --endpoint http://localhost:9324 sqs send-message-batch --queue-url http://localhost:9324/queue/queue-name.fifo --entries Id="I",MessageBody="I",MessageGroupId="messageGroupId",MessageDeduplicationId="I" Id="II",MessageBody="II",MessageGroupId="messageGroupId",MessageDeduplicationId="II" Id="III",MessageBody="III",MessageGroupId="messageGroupId",MessageDeduplicationId="III"

Receive messages

aws --endpoint http://localhost:9324 sqs receive-message --queue-url http://localhost:9324/queue/queue-name.fifo --max-number-of-messages 10
@dcortesnet
Copy link

Thanks for shared! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment