Getting Started with Amazon SQS
This section helps you become more familiar with Amazon SQS by showing you how to manage queues and messages using the AWS Management Console.
Prerequisites
Before you begin, complete the steps in Setting Up Amazon SQS.
Step 1: Create a Queue
The first and most common Amazon SQS task is creating queues. In this tutorial you'll learn how to create and configure a queue.
-
Sign in to the Amazon SQS console.
-
Choose Create New Queue.
-
On the Create New Queue page, ensure that you're in the correct region and then type the Queue Name.
Note
The name of a FIFO queue must end with the
.fifosuffix. FIFO queues are available in the US East (N. Virginia), US East (Ohio), US West (Oregon), and EU (Ireland) Regions. -
Standard is selected by default. Choose FIFO.
-
To create your queue with the default parameters, choose Quick-Create Queue.
Your new queue is created and selected in the queue list.
Note
When you create a queue, it can take a short time for the queue to propagate throughout Amazon SQS..
The Queue Type column helps you distinguish standard queues from FIFO queues at a glance. For a FIFO queue, the Content-Based Deduplication column displays whether you have enabled exactly-once processing.
Your queue's Name, URL, and ARN are displayed on the Details tab.
Step 2: Send a Message
After you create your queue, you can send a message to it. The following example shows sending a message to an existing queue.
-
From the queue list, select the queue that you've created.
-
From Queue Actions, select Send a Message.
The Send a Message to
QueueNamedialog box is displayed.The following example shows the Message Group ID and Message Deduplication ID parameters specific to FIFO queues (content-based deduplication is disabled).
-
To send a message to a FIFO queue, type the Message Body, the Message Group ID
MyMessageGroupId1234567890, and the Message Deduplication IDMyMessageDeduplicationId1234567890, and then choose Send Message. For more information, see FIFO Delivery Logic.Note
The message group ID is always required. However, if content-based deduplication is enabled, the message deduplication ID is optional.
Your message is sent and the Send a Message to
QueueNamedialog box is displayed, showing the attributes of the sent message.The following example shows the Sequence Number attribute specific to FIFO queues.
-
Choose Close.
Step 3: Receive and Delete Your Message
After you send a message into a queue, you can consume it (retrieve it from the queue). When you request a message from a queue, you can't specify which message to get. Instead, you specify the maximum number of messages (up to 10) that you want to get.
In this tutorial you'll learn how to receive and delete a message.
-
From the queue list, select the queue that you have created.
-
From Queue Actions, select View/Delete Messages.
The View/Delete Messages in
QueueNamedialog box is displayed.Note
The first time you take this action, an information screen is displayed. To hide the screen, check the Don't show this again checkbox.
-
Choose Start Polling for messages.
Amazon SQS begins to poll the messages in the queue. The dialog box displays a message from the queue. A progress bar at the bottom of the dialog box displays the status of the message's visibility timeout.
The following example shows the Message Group ID, Message Deduplication ID, and Sequence Number columns specific to FIFO queues.
Note
When the progress bar is filled in, the visibility timeout expires and the message becomes visible to consumers.
-
Before the visibility timeout expires, select the message that you want to delete and then choose Delete
1Message.
-
In the Delete Messages dialog box, confirm that the message you want to delete is checked and choose Yes, Delete Checked Messages.
The selected message is deleted.
-
Select Close.
Step 4: Delete Your Queue
If you don't use an Amazon SQS queue (and don't foresee using it in the near future), it is a best practice to delete it from Amazon SQS. In this tutorial you'll learn how to delete a queue.
-
From the queue list, select the queue that you have created.
-
From Queue Actions, select Delete Queue.
The Delete Queues dialog box is displayed.
-
Choose Yes, Delete Queue.
The queue is deleted.
Next Steps
Now that you've created a queue and learned how to send, receive, and delete messages and how to delete a queue, you might want to try the following:
-
Enable server-side encryption (SSE) for a new queue or configure SSE for an existing queue.
-
Configure messages arriving in a queue to trigger a Lambda function.
-
Learn more about Amazon SQS workflows and processes: Read How Queues Work, Best Practices, and Limits. You can also explore the Amazon SQS Articles & Tutorials. If you ever have any questions, browse the Amazon SQS FAQs or participate in the Amazon SQS Developer Forums.
-
Learn how to interact with Amazon SQS programmatically: Read Working with APIs and explore the Sample Code and Libraries and the developer centers:
-
Learn about keeping an eye on costs and resources in the Amazon SQS Monitoring, Logging, and Automating section.
-
Learn about protecting your data and access to it in the Security section.
