Tutorials References Exercises Videos Menu
Paid Courses Website NEW Pro NEW

AWS Serverless Asynchronous Event Submission With an SQS Queue


What is AWS SQS

AWS SQS stands for AWS Simple Queue Service.

It exchanges messages between components.

A component is part of the software with its own behavior and data.


How AWS SQS Works

AWS SQS works in steps:

  1. The message is added in a queue
  2. The message is picked from the queue
  3. Message is processed
  4. The message is deleted from the queue

Read more about AWS SQS:

Read about AWS SQS introduction here
Read about AWS SQS overview here
Read about AWS SQS limits here

AWS SQS Video

W3schools.com collaborates with AWS Web Services to deliver digital training content to our students.


Asynchronous Event Submission With an SQS Queue

Amazon SQS creates an asynchronous connection between Lambda and the API request.

It satisfies the request regardless of how long the Lambda function will run.

SQS queues are backed up with built-in retries, should any queue fail.

The Lambda holds a client connection until data is available.

This process is called long polling.



How Asynchronous Event Submission Works

When the client sends a request, it passes through the API Gateway.

The API Gateway sends the request to Amazon SQS and receives a message ID.

With a message ID, a client can track the message.

The message gets stored in the queue which Lamba polls.

When Lambda finds a new message in a queue, it invokes the Lambda function.

Lambda function then processes the message.

Related reads:

AWS Cloud Lambda
Using AWS Lambda with Amazon SQS

Standard Queues vs. FIFO Queues

Amazon SQS has two types of queues. The Standard queue and the FIFO queue.

FIFO stands for First-In-First-Out.

It means that the data that goes into the queue first should be retrieved first.

The table below shows the difference between the two.

FIFO Standard
Can deliver 300 messages per second, per API action Can deliver an almost unlimited number of messages per second
Can deliver messages more than once Can deliver messages more than once
The message order is assured based on the group ID The order of messages isn't guaranteed

AWS Serverless Exercises

Test Yourself With Exercises

Exercise:

What does AWS SQS stands for?

AWS Simple  Service

Start the Exercise