Creating an SQS Queue on AWS: A Step-by-Step Guide

 

Amazon Simple Queue Service (SQS) is a fully-managed message queuing service provided by AWS, enabling you to decouple and scale microservices, distributed systems, and serverless applications. With SQS, messages can be sent, stored, and received between software components at any scale without message loss. Standard queues provide maximum throughput, best-effort ordering, and at-least-once delivery. FIFO queues ensure that messages are processed exactly once, in the precise order they are sent.

SQS eliminates administrative overhead, ensures reliable message delivery, safeguards sensitive data, and scales elastically and cost-effectively.

Security, Durability, Availability, Scalability, Reliability, and Customization are key benefits of using SQS.

There are 2 types of SQS Queues on AWS:

  1. Standard Queue
  2. FIFO Queue
  1. Standard Queue: Supports a nearly unlimited number of transactions per second (TPS) per API action. A message is delivered at least once but may occasionally be delivered more than once. Messages might be delivered in a different order from which they were sent.
  2. FIFO Queue: Supports up to 3,000 messages per second (TPS) per API action. A message is delivered once and remains available until processed and deleted by the consumer. Message order is strictly preserved.

To learn more about SQS Queues, click here.

SQS charges you only for what you use, with no minimum fees. For AWS SQS pricing details, click here.

In this article, we will explore the steps to create both Standard and FIFO Queues, send messages to them, delete messages, and remove the Queues.

Pre-requisites

  1. AWS Account (Create if you don’t have one).

What will we do?

  1. Log in to AWS.
  2. Create SQS Queues and Send Messages
  3. View and delete Messages from the queues
  4. Delete the Queues

Log in to AWS

  1. Log in to AWS using your credentials.

After logging in, you’ll see the AWS Management Console with a list of all services.

Login to AWS

AWS Management Console

Create SQS Queues

Click on “Services” at the top left, search for “SQS”, and click on “Simple Queue Service”.

Create SQS Queue

You will see the Main Page. Click on “Get started Queue”.

Simple Queue Service

On the “Create New Queue” page, give a name to the Standard Queue and scroll down.

Set Queue name

After naming the Standard Queue, click on the “Create Queue” button at the bottom left.

Resource Groups

Once the Standard Queue is created, select the Queue and click on “Queue Actions” and “Send a Message”.

Send a Message

Type a message that you want to send and click on the “Send Message” button.

Message Body

You’ll be prompted to send another message or click “Close”.

Test Message Queue

To create a FIFO Queue, select “FIFO Queue” and provide a name. After naming the FIFO Queue, scroll down.

Create FIFO Queue

Click on “Quick-Create Queue”.

FIFO Queue resource group

Once the FIFO Queue is created, select the Queue and click on “Queue Actions” and “Send a Message”.

Send a message to FIFO Queue

Enter the message you want to send to the FIFO Queue, provide a Message Group ID and Message Duplication ID, and click “Send Message”.

Message body content

You can choose to send another message or click “Close”.

Test success

View and Delete Messages from the Queue

Select the Queue name from which you want to read the messages sent in the steps above.

Using the Standard Queue, click “Quick Actions” -> “View/Delete Messages”.

View Delete Messages

Click “Start Polling for Messages”.

Poll Messages

You will see the message sent in the previous step. To delete it, select the message and click “Delete 1 Message”.

Remove message from queue

In the confirmation box, click “Yes, Delete Checked Messages” to complete the deletion.

Delete Checked Messages

Similarly, view or delete messages sent to a FIFO Queue. Select the FIFO queue, click “Quick Actions” -> “View/Delete Messages”.

View Deleted Messages

Click “Start Polling for Messages” to view the messages sent earlier.

Message Body details

Select the message you wish to delete and click “Delete 1 Message”.

Stop queue now

Confirm by clicking “Yes, Delete Checked Message”.

Delete Checked message

Delete Queues

Select the Queues for deletion, click “Quick Actions” and “Delete Queues”.

Delete SQL Queue

On the confirmation page, click “Yes, Delete 2 Queues”.

Continue Deleting queues

Conclusion

In this article, we explored how to create Standard and FIFO queues, send and manage messages, and delete queues using AWS SQS.

Frequently Asked Questions

What is Amazon SQS?

Amazon SQS is a simple, scalable, fully-managed message queuing service that allows applications to communicate via messages asynchronously.

What are the types of queues in AWS SQS?

There are two types of queues in AWS SQS: Standard Queue and FIFO Queue.

How is FIFO different from Standard Queue?

FIFO queues deliver messages in the exact order they are sent and ensure that each message is processed exactly once, while Standard queues provide best-effort ordering and at-least-once delivery.

Is there a minimum charge for using SQS?

No, SQS charges only based on usage with no minimum fees.

Where can I find more information about AWS SQS pricing?

More information on AWS SQS pricing can be found here.