1 Answer

0 votes
by
selected by
 
Best answer
What is SQS?

SQS stands for Simple Queue Service.

SQS was the first service available in AWS.

Amazon SQS is a web service that gives you access to a message queue that can be used to store messages while waiting for a computer to process them.

Amazon SQS is a distributed queue system that enables web service applications to quickly and reliably queue messages that one component in the application generates to be consumed by another component where a queue is a temporary repository for messages that are awaiting processing.

With the help of SQS, you can send, store and receive messages between software components at any volume without losing messages.

Using Amazon sqs, you can separate the components of an application so that they can run independently, easing message management between components.

Any component of a distributed application can store the messages in the queue.

Messages can contain up to 256 KB of text in any format such as json, xml, etc.

Any component of an application can later retrieve the messages programmatically using the Amazon SQS API.

The queue acts as a buffer between the component producing and saving data, and the component receives the data for processing. This means that the queue resolves issues that arise if the producer is producing work faster than the consumer can process it, or if the producer or consumer is only intermittently connected to the network.

If you got two EC2 instances which are pulling the SQS Queue. You can configure the autoscaling group if a number of messages go over a certain limit. Suppose the number of messages exceeds 10, then you can add additional EC2 instance to process the job faster. In this way, SQS provides elasticity.

Let's understand through an example.

SQS

Let's look at a website that generates a Meme. Suppose the user wants to upload a photo and wants to convert into Meme. User uploads a photo on a website and website might store a photo in s3. As soon as it finished uploads, it triggers a Lambda function. Lambda analyzes the data about this particular image to SQS, and this data can be "what the top of the meme should say", "what the bottom of the meme should say", the location of the S3 bucket, etc. The data sits inside the SQS as a message. An EC2 instance looks at the message and performs its job. An EC2 instance creates a Meme and stores it in S3 bucket. Once the EC2 instance completed its job, it moves back to the SQS. The best thing is that if you lose your EC2 instance, then also you would not lose the job as the job sits inside the S3 bucket.

Related questions

+1 vote
asked Sep 6, 2019 in AWS by tiger
+1 vote
asked Sep 6, 2019 in AWS by tiger
...