Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

💝 Valentine's Sale! Get 30% OFF Any Reviewer. Use coupon code: PASSION-4-CLOUD & 10% OFF Store Credits/Gift Cards

Guided Lab: Amazon SQS FIFO Queues Overview

Description

Amazon Simple Queue Service (SQS) FIFO (First-In-First-Out) Queues ensure that the order in which messages are sent and received is strictly preserved, and each message is processed only once. This makes SQS FIFO queues ideal for use cases where the order of operations and processing must be strictly maintained, such as financial transactions, inventory management, or messaging between microservices where a particular sequence must be enforced.

This lab will guide you through creating and working with an Amazon SQS FIFO queue in the AWS Management Console. You will explore how the FIFO mechanism works by sending messages with different Message Group IDs and viewing how message ordering and deduplication behave in real-time.

Prerequisites

This lab assumes you have the following:

  • Basic knowledge and understanding of AWS services, particularly Amazon SQS

If you find any gaps in your knowledge, consider taking the following lab:

Objectives

By the end of this lab, you will:

  • Create and configure an Amazon SQS FIFO queue in the AWS Management Console.
  • Explore how the FIFO mechanism works by sending messages with different Message Group IDs.
  • View how message ordering and deduplication behave in real-time.

Lab Steps

Create a SQS FIFO Queue

1. Navigate to the Amazon SQS service:

  • Use the search bar to find “SQS,” then select it from the list of services.

2. Create a new queue:

a. Click on “Create queue”.

b. Choose “FIFO queue” for this lab.

c. Name the queue using a unique name followed by .fifo (e.g., OrderProcessing.fifo).

d. In the FIFO queue settings, enable Content-based deduplication.

e.  Leave the rest as default and click “Create Queue”.

Scenario 1: Sending Messages with the Same Group ID

1. Once the queue is created, click on Send and receive messages
2. Under Edit Poll settings, change the Maximum message count to 1. Then, Save.

This setting limits the number of messages returned by the polling request.

3. Send three messages sequentially with the same Message Group ID (td-01):

  • First message:
    • Message body: a1
    • Message Group ID: td-01

  • Second message:
    • Message body: a2
    • Message Group ID: td-01

  • Third message:
    • Message body: a3
    • Message Group ID: td-01

4. Now we have 3 messages available:

5. Testing:

  • In the Receive messages section, click Poll for messages and observe the result.

  • Click the ID. Since the maximum message count is set to 1, only the first message (a1) will be retrieved.

  • You will still poll the same message even if you click Poll for messages again.

Note: This confirms that messages are being processed in FIFO order.

Scenario 2: Sending Messages with Different Group ID

1. Now, send two messages for Group ID td-02:

  • First message:
    • Message body: b1
    • Message Group ID: td-02

  • Second message:
    • Message body: b2
    • Message Group ID: td-02

  • Third message:
    • Message body: b3
    • Message Group ID: td-02

2. Next, send three messages for Group ID td-03:

  • First message:
    • Message body: c1
    • Message Group ID: td-03

  • Second message:
    • Message body: c2
    • Message Group ID: td-03

  • Third message:
    • Message body: c3
    • Message Group ID: td-03

3. Testing:

  • In the Receive messages section, click Poll for messages and then click the ID of the Message.

  • Poll for messages again and observe the behavior. Since the polling is still set to return one message, it will retrieve only one message from the available message groups. The specific group from which it retrieves a message may vary depending on the message received first. 

  • Poll for messages again, and you will see the first message of the third message group.

Note: Different Message Group IDs allow parallel processing, so messages from different groups can be received independently.

Increase Poll Settings for Maximum Message Count

1. Change the Maximum message count to 3 in the Poll settings. Then, Save.

2. Poll for messages again. You should see three messages. Click each ID, and these should belong to one of the Group ID

3. Repeat the poll, and you should see the other three messages of other group ID

4. Poll again to see the three messages of the other group ID.

That’s it! Congratulations! You just learned how to create and interact with Amazon SQS FIFO queues. We explored using Message Group IDs to enforce strict ordering within groups, how to use deduplication mechanisms, and confirmed message processing behavior through practical examples. Understanding FIFO queues is essential for critical message order and exact-once processing scenarios.

As a best practice, remember to delete any resources no longer in use, such as SQS queues, to maintain a clutter-free AWS environment.

Thank you for joining this lab, and happy learning!

Skip to content