0
0
AWScloud~5 mins

Standard vs FIFO queues in AWS - CLI Comparison

Choose your learning style9 modes available
Introduction
Queues help different parts of a system talk to each other by sending messages. Standard queues let messages flow fast and in any order. FIFO queues keep messages in the exact order they were sent and make sure no message is lost or repeated.
When you want to send messages quickly and order does not matter, like logging events.
When you need to make sure messages are processed exactly once and in order, like processing bank transactions.
When you want to handle a large number of messages with high throughput and occasional duplicates are okay.
When you need strict message order and no duplicates for critical workflows.
When you want to connect parts of your app that can work independently without worrying about message order.
Commands
This command creates a standard queue named 'my-standard-queue' which allows high throughput and at-least-once delivery without guaranteed order.
Terminal
aws sqs create-queue --queue-name my-standard-queue
Expected OutputExpected
{"QueueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/my-standard-queue"}
--queue-name - Specifies the name of the queue to create
This command creates a FIFO queue named 'my-fifo-queue.fifo' that guarantees message order and exactly-once processing with content-based deduplication.
Terminal
aws sqs create-queue --queue-name my-fifo-queue.fifo --attributes FifoQueue=true,ContentBasedDeduplication=true
Expected OutputExpected
{"QueueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/my-fifo-queue.fifo"}
--queue-name - Specifies the name of the queue to create; FIFO queues must end with .fifo
--attributes - Sets queue properties; here enabling FIFO and content-based deduplication
Sends a message 'Order123' to the FIFO queue with a message group ID to keep order within that group.
Terminal
aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-fifo-queue.fifo --message-body "Order123" --message-group-id "group1"
Expected OutputExpected
{"MD5OfMessageBody": "e4d909c290d0fb1ca068ffaddf22cbd0", "MessageId": "1234abcd-12ab-34cd-56ef-1234567890ab"}
--queue-url - Specifies the full URL of the queue to send the message to
--message-body - The content of the message being sent
--message-group-id - Required for FIFO queues to group messages for ordering
Retrieves one or more messages from the FIFO queue to process them in order.
Terminal
aws sqs receive-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-fifo-queue.fifo
Expected OutputExpected
{"Messages": [{"MessageId": "1234abcd-12ab-34cd-56ef-1234567890ab", "ReceiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...", "MD5OfBody": "e4d909c290d0fb1ca068ffaddf22cbd0", "Body": "Order123"}]}
--queue-url - Specifies the queue to receive messages from
Key Concept

If you remember nothing else from this pattern, remember: standard queues are fast and unordered with possible duplicates, while FIFO queues keep strict order and exactly-once delivery.

Common Mistakes
Creating a FIFO queue without the .fifo suffix in the name
AWS requires FIFO queue names to end with .fifo or the creation will fail
Always add .fifo at the end of FIFO queue names when creating them
Sending messages to a FIFO queue without specifying a message group ID
FIFO queues require a message group ID to maintain order; missing it causes an error
Include --message-group-id with a string value when sending messages to FIFO queues
Expecting standard queues to deliver messages in order
Standard queues do not guarantee message order and may deliver duplicates
Use FIFO queues when message order and exactly-once delivery are required
Summary
Create standard queues for fast, unordered message delivery with possible duplicates.
Create FIFO queues with .fifo suffix and enable FIFO attributes for ordered, exactly-once messages.
Send messages to FIFO queues with a message group ID to keep order within groups.
Receive messages from queues to process them according to the queue type guarantees.