LAB Configure SQS in AWS
LAB Configure SQS in AWS
Getting Started with Amazon SQS
Before you can use Amazon SQS for the first time, you must complete the following steps.
Step 1: To create an IAM user for yourself and add the user to an Administrators group
Use your AWS account email address and password to sign in as the AWS account root user to the IAM console at https://console.aws.amazon.com/iam/.
In the navigation pane of the console, choose Users, and then choose Add user.
For User name, type Administrator.
Select the check box next to AWS Management Console access, select Custom password, and then type the new user's password in the text box. You can optionally select Require password reset to force the user to create a new password the next time the user signs in.
Choose Next: Permissions.
On the Set permissions for user page, choose Add user to group.
Choose Create group.
In the Create group dialog box, type Administrators.
For Filter, choose Job function.
In the policy list, select the check box for Administrator Access. Then choose Create group.
Back in the list of groups, select the check box for your new group. Choose Refresh if necessary to see the group in the list.
Step 2: Get Your Access Key ID and Secret Access Key
To use Amazon SQS actions (for example, using Java or through the AWS Command Line Interface), you need an access key ID and a secret access key. The access key ID and secret access key are specific to AWS Identity and Access Management.
Open the IAM console.
In the navigation pane of the console, choose Users.
Choose your IAM user name
Choose the Security credentials tab and then choose Create access key.
To see the new access key, choose Show. Your credentials will look something like this:
- Access key ID: AKIAIOSFODNN7EXAMPLE
- Secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
To download the key pair, choose Download .csv file. Store the keys in a secure location.
Step 3: Create a Queue
Sign in to the Amazon SQS console. https://console.aws.amazon.com/sqs/home
Choose Create New Queue.
On the Create New Queue page, ensure that you're in the correct region and then type the Queue Name. The name of a FIFO queue must end with the .fifo suffix. 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.
Step 4: 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 QueueName dialog 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 1234567890, and the Message Deduplication ID 1234567890, and then choose Send Message
Your message is sent and the Send a Message to QueueName dialog box is displayed, showing the attributes of the sent message.
The following example shows the Sequence Number attribute specific to FIFO queues.
Step 5: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.
The following example shows 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.
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.
Before the visibility timeout expires, select the message that you want to delete and then choose Delete 1 Message.
The Delete Messages dialog box is displayed.
Confirm that the message you want to delete is checked and choose Yes, Delete Checked Messages.
The selected message is deleted.
Step 6: 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. The following example shows how to delete a queue.
From the queue list, select the queue that you have created.
The Delete Queues dialog box is displayed.
Choose Yes, Delete Queue.
The queue is deleted.