How to create a simple Queue in AWS SQS

Matheus Silva
4 min readFeb 16, 2023

--

In this tutorial I'll show to you how simple is to create a queue in AWS SQS

1. Pre Reqs

I expect that you already have an account in AWS and that you have some familiarity with AWS console

2. Overview

Asynchronous communication is commun Asynchronous communication means communication which happens ‘out of sync’ or in other words.

Is important to understand that messages in a queue cannot be received by multiple receivers at the same time. Any one receiver can receive a message, process and delete it.

2. Pricing

One important thing when we think about bringing some components to our architecture is how much it will cost.

I saw many projects fail because they cost much more than give a return. Then is important to understand the pricing of the SQS.

https://aws.amazon.com/sqs/pricing/

3. Let's start our queue…

In AWS console you can search by name SQS:

And then click in Create Queue:

We have two: Standard and Fifo

Is important to understand the differences between each one because will affect how will it work.

Standard:

  • A message is delivered at least once, but occasionally more than one copy of a message is delivered;
  • Standard queues provide best-effort ordering. Occasionally, messages might be delivered in an order different from which they were sent;
  • Standard queues are useful when very high throughput is important

Fifo:

  • FIFO queues support up to 3000 messages per second;
  • Each message is delivered exactly once;
  • FIFO queues are designed to enhance messaging between applications when the order of operations and events is critical, or where duplicates can’t be tolerated

After that, you understood the differences and choose one that has match the use case, you will need to give a name to it.

Then we have some settings that we can adjust to our use case:

  • Visibility Timeout

Visibility timeout sets the length of time that a message received from a queue (by one consumer) will not be visible to the other message consumers.

Default value is 30 seconds how we can se.

  • Message retention period

The message retention period is the amount of time that Amazon SQS retains a message that does not get deleted.

Default value is 4 days and the max retation time is 14 days.

  • Delivery Delay

The delivery delay is the amount of time to delay the first delivery of each message added to the queue. Any messages that you send to the queue remain invisible to consumers for the duration of the delay period.

Default delay for a queue is 0 seconds. The maximum is 15 minutes.

  • Maximum message size

You can set the maximum message size for your queue. The smallest supported message size is 1 byte (1 character). The largest size is 262,144 bytes (256 KB).

  • Receive message wait time

The receive message wait time is the maximum amount of time that polling will wait for messages to become available to receive. The minimum value is zero seconds and the maximum value is 20 seconds.

After you set this configuration according with your use case you can go to de bottom and click in Crete queue

Voilà

It's created.

Using the console is very simple to create a queue in SQS, what will be a difference for you as a software engineer, is understanding the type of queue that you will use for your use case, considering the cost, and being capable of understanding each configuration to tunning your queue according with de necessity.

Next post

I will prepare an article to show to you how to consume a message from our SQS queue with Java.

--

--