Amazon Simple Queue Service (Amazon SQS)
Amazon Simple Queue Service, in this Tutorial one, you can learn Amazon Simple Queue Service. Are you the one who is looking for the best platform which provides information about Amazon Simple Queue Service? Or the one who is looking forward to taking the advanced Certification Course from India’s Leading AWS Training institute? Then you’ve landed on the Right Path.
The Below mentioned Tutorial will help to Understand the detailed information about Amazon Simple Queue Service, so Just Follow All the Tutorials of India’s Leading Best AWS Training institute and Be a Pro AWS Developer.
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.
♦ SQS eliminates the difficulty and problems associated with managing and operating message-oriented middleware and empowers developers to focus on differentiating work.
Using SQS (Simple Queue Service), you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available.
♦ SQS is designed to provide a highly scalable hosted message queue that resolves issues or problems arising from the common producer-consumer problem or connectivity between producer and consumer.
Introduction
Amazon SQS is managed message queuing service comes under Amazon Web Services Products Application Integration with various important features which are stated below:
Multiple producers and consumers can interact with the SQS at the same time.
♦ Loose Coupling-> high availability, scalability, and reliability for your architecture.
Uses multiple redundant AZs within a region->prevent message loss due to single point failure.
♦Integrated with IAM-> you can decide who can access it.
It Can send/receive/delete a maximum of 10 messages in a request in case of batch request and in case of single request message limit is 1.
♦ Message Timer: Let’s you specify an initial invisibility period for a message.
The message Retention period is: 1 minute-14 day (default 4 days)
♦ Visibility Timeout: Makes messages unavailable for other components when one component is processing it.
Delay Queue: Postpones message delivery, & makes messages invisible during the delay period. (0 seconds-15 minutes)
♦ Dead Letter Queue: A queue to send messages which were not successfully processed.
Amazon SQS Access Control: Allows you to grant particular interactions to other accounts by assigning policies to SQS queues.
♦ SQS Long Polling: Long polling eliminates false empty responses by querying all (rather than a limited number) of the servers.
Why Amazon SQS?
Amazon SQS used because it has innumerable benefits and some of them are stated below:
♦ Security: Server-side encryption (SSE)lets you transmit sensitive data by protecting the contents of messages in queues using keys managed in AWS Key Management Service (AWS KMS), it provides security.
Durability: To ensure the safety of your messages, Amazon SQS stores them on multiple servers, because Amazon’s first priority is your security.
♦ Availability: Amazon SQS uses redundant infrastructure to provide highly- synchronous access to messages and high availability for producing and consuming messages.
Scalability: Amazon SQS can process each buffered request independently, scaling transparently to handle any load increases or spikes without any managing instructions.
Reliability: Amazon SQS locks your messages during processing so that multiple producers can send and multiple consumers can receive messages at the same time simultaneously.
♦ Customization: You can store the contents of messages larger than 256 KB using Amazon Simple Storage Service (Amazon S3) or Amazon DynamoDB, with Amazon SQS holding a pointer to the Amazon S3 object, or you can divide a large message into smaller messages.
Amazon SQS Integration with other AWS services: Amazon SQS integrated with computing services such as Amazon EC2, Amazon EC2 Container Service (Amazon ECS), and AWS Lambda, as well as with storage and database services such as Amazon Simple Storage Service (Amazon S3)and Amazon DynamoDB.
Amazon SQS Free Tier- The Amazon SQS Free Tier provides you with 1 million requests per month at no charge.
How Amazon SQS works?
This section overviews the parts of a distributed messaging system and explains the lifecycle of an Amazon SQS message.
Distributed Queues
There are three main parts in a distributed messaging system: the components of your distributed system, your queue (distributed on Amazon SQS servers), and the messages in the queue.
In the following example, your system has several components that send messages to the queue and receive messages from the queue. The queue (which holds messages A through E) redundantly stores the messages across multiple Amazon SQS servers as shown in the example given below:
Message Lifecycle
The following example describes the lifecycle of an Amazon SQS message in a queue, from creation to deletion of the message.
- A producer (component 1) sends message A to a queue, and the message is distributed across the Amazon SQS servers redundantly.
- When a consumer (component 2) is ready to process messages, it consumes messages from the queue, and message A is returned, you can see in the diagram given above. While message A is being processed, it remains in the queue and isn’t returned to subsequent receive requests until visibility timeout.
- The consumer (component 2) deletes message A from the queue to prevent the message from being received and processed again when the visibility timeout expires.
Note:
Amazon SQS automatically deletes messages that have been in a queue for more than a maximum message retention period. The default message retention period is 4 days. However, you can set the message retention period to a value from 1minute to 14 days using the SetQueueAttributes action.
AWS SQS offers two types of message queues
Standard Queues (default)
♦ Unlimited Throughput: Standard queues support a nearly unlimited number of transactions per second (TPS) per API action.
At-Least-Once Delivery: A message is delivered to the consumer at least once, but occasionally more than one copy of a message is delivered.
♦ Best-Effort Ordering: Occasionally, messages might be delivered in an order different from which they were sent.
FIFO Queues (First-In-First-Out)
♦ High Throughput: FIFO queues support up to 300 messages per second (300 send, receive, or delete operations per second). When you batch 10 messages per operation (maximum) in FIFO Queue, it can support up to 3,000 messages per second. To request a limit increase, file a support request.
First-In-First-out Delivery: The order in which messages are sent and received is strictly preserved.
♦ Exactly-Once Processing: A message is delivered once and remains available until consumer processes and deletes it. Duplicates are not introduced into the queue.
Batch Operations Supported by Amazon SQS
♦ RecieveMessageBatch
SendMessageBatch
♦ DeleteMessageBatch
ChangeMessageVisibilityBatch
Other Amazon SQS Defined Operations
♦ CreateQueue
ListQueue
♦ DeleteQueue
SendMessage
♦ RecieveMessage
DeleteMessage
♦ PurgeQueue
ChangeMessageVisibility
♦ SetQueueAttributes
GetQueueAttributes
♦ GetQueueUrl
ListDeadLetterSourceQueues
♦ AddPermission
RemovePermission
Difference between deleting and purging messages in SQS
♦ DeleteMessage: Delete a specific message.
DeleteMessageBatch: Delete multiple messages.
♦ PurgeQueue: Delete all the messages; keep the queue.
Components of SQS Metadata
Some of the components of SQS metadata could be
♦ Identifiers
Geospatial Data
♦ Timestamps
Signatures
Amazon SQS Message Identifiers
SQS uses 3 message identifiers:
♦ Queue URLs
Message IDs
♦ Receipt Handles
How to access Amazon SQS?
♦ Using Console: –
You can access Amazon SQS simply by sign in your AWS Account Click on My Account -> AWS Management Console -> Click on Services -> Search for Amazon SQS under Application Integration then click on it -> you will be redirected on Amazon SQS Create Queue page.
Using CLI (Command Line Interface):-
You can use the AWS CLI for ad hoc operations, such as creating a Queue. You can also use it to embed Amazon SQS operations within utility scripts.
Before you can use the AWS CLI with Amazon SQS, you must get an access key ID and secret access key.
♦Using API: –
Using AWS SDKs you can make the most of Amazon SQS. AWS SDK supports a variety of languages like Java, JavaScript, .NET, Node.js, Ruby, Go, C++, Python, PHP, etc.
Before you can use the AWS SDKs with Amazon SQS, you must get an AWS access key ID and secret access key.
# Last but not least, always asks for help!