AWS SQS Tutorial for Beginners

Go Cloud Architects
4 min readDec 7, 2020

As Internet applications become more and more important in our daily lives, creating scalable and available applications is increasingly critical. One AWS service that can dramatically help with database and application scalability, performance and availability is AWS Simple Queueing Service (SQS). AWS SQS is a key component to AWS Certified Solution Architect Associate and professional exams, so if you are looking to become a certified solutions architect this is an important topic.

AWS Simple Queueing Service (SQS)

To design a highly available and scalable application, it is sometime necessary to decouple the components of an application’s architecture. By decoupling the application’s architecture, it is possible to minimize system bottlenecks and optimize performance of the entire system. A great option for decoupling application architectures is the Amazon Simple Queueing Service (SQS).

SQS is a message queuing service that provides temporary message storage prior to the message being transmitted to its ultimate destination. SQS enhances application availability by providing a way to retain messages when a part of the application’s architecture is busy or unavailable. Since SQS can hold messages on the way to the destination, the organization can optimally size their architecture. If a traffic spike occurs, SQS will store and deliver the message when it’s ready.

The diagram below shows how SQS can optimize performance and help promote scalability.

SQS is used to decouple application architecture components, which promotes scalability. SQS can further increase scalability and elasticity of services when SQS is used to autoscale instances based on the message’s depth of the SQS queue. SQS can take the place of messaging middleware in multitiered applications. SQS is highly available, and multiple copies of every message are stored redundantly. SQS has integration with KMS to allow for end-to-end encryption. SQS is highly tunable transient storage. The SQS message queue retention period can be adjusted for up to fourteen days, with the default storage time being four days.

The diagram below shows how SQS queues are used to decouple application architecture components.

SQS can be configured for standard queues (the default), first in, first out (FIFO) queues and dead-letter queues. The key attributes of these queue types are:

Standard Queues

· Super-fast and support a nearly unlimited number of requests per second.

· Offers the fastest throughput and message delivery.

· Every message is delivered at least once.

· Best effort delivery, and messages may be delivered out of order.

First In, First Out Queues

· High throughput but much slower than standard queues.

· First in, first out delivery guarantees the messages will be processed once and in the order they are received.

· Since messages are sent in the order they are received, it is possible the FIFO queue will increase latency because all new messages will be waiting for the previous message to be processed.

Dead-Letter Queues

· Dead-letter queues (DLQ) can be set up to retain undeliverable messages if an error occurs in the system.

How SQS Works

1. Messages are sent from the computing platform to the queue as a step to their ultimate destination.

2. After the message is inside the queue, it can be scheduled for delivery based upon the capacity of the ultimate destination for the message.

3. If the ultimate destination is busy, the message can stay in the queue until it is processed or times out. The message can stay in the queue for up to fourteen days based upon the SQS configuration.

4. The message is pulled from the queue to be processed.

5. After the message is completely processed, the message is deleted from the queue.

The diagram below shows how SQS is used to reliably deliver messages to their ultimate destination.

When to Use SQS

SQS can be extremely beneficial in designing a highly-available and scalable architecture. Some key situations where SQS can make a notable difference:

· With capacity planning and application scalability.

· To make sure messages (orders) are not lost if part of the system is overloaded (i.e., database on multitiered application).

· For cost optimization, as it offers the ability to right-size the instances supporting an application.

· For autoscaling, with its ability to trigger autoscaling based upon queue depth, as opposed to a less direct metrics, i.e., CPU utilization.

· To support an application’s ability to handle large spikes in traffic, without having to scale or make changes to the platform

· To handle increased traffic destined for databases, often without the need to increase write capacity on the database.

We hope you have enjoyed this AWS SQS Tutorial for beginners.

If you enjoyed this content, please subscribe like our blog, and forward to others who you believe would benefit from this information.

Get a FREE AWS Certified Solutions Architect Associate eBook from Go Cloud Architects by clicking on the link below:

https://www.gocloudarchitects.com/free-csa-a-ebook/

Download a FREE AWS Certified Solutions Architect Professional Practice Exam at the link below:

https://www.gocloudarchitects.com/free_exam/

We have new cloud computing videos every Wednesday on our YouTube channel.

https://www.youtube.com/c/GoCloudArchitects

Visit our website at www.gocloudarchitects.com

--

--

Go Cloud Architects
Go Cloud Architects

Written by Go Cloud Architects

Go Cloud Architects is a provider of cloud computing training. We make cloud computing simple so our clients can truly understand cloud computing.

No responses yet