1. Home
  2. Training Library
  3. Amazon Web Services
  4. Courses
  5. AWS Solutions Architect Associate Level Certification Course: Part 3 of 3

SQS: Simple Queue Service

Start course
1h 10m

AWS Solutions Architect Associate Level Certification Course - Part 3 of 3

Having completed parts one and two of our AWS certification series, you should now be familiar with basic AWS services and some of the workings of AWS networking. This final course in our three-part certification exam preparation series focuses on data management and application and services deployment.

Who should take this course?

This is an advanced course that's aimed at people who already have some experience with AWS and a familiarity with the general principles of architecting cloud solutions.

Where will you go from here?

The self-testing quizzes of the AWS Solutions Architect Associate Level prep materialis a great follow up to this series...and a pretty good indicator of your readiness to take the AWS exam. Also, since you're studying for the AWS certification, check out our AWS Certifications Study Guide on our blog.


One key benefit of SQS comes from the way it acts as a buffer between your applications, allowing them to remain in contact with each other while working independently, each at it's own pace. For example, a producing application might send data or instructions to some consuming application, confident that even if some connectivity issue temporarily breaks communication or if the consumer application can't handle requests at the speed they're being sent, the SQS queue will patiently hold all its messages until they can be successfully delivered. You're normally going to access this service programmatically. In fact, SQS doesn't really make a lot of sense in any other context. So we'll show a brief example of that a bit later. For now though, we'll work with the management console to illustrate SQS's basic functions. The heart of SQS is predictably, the queue.

That's the container that holds and organizes your messages. So let's confirm that we're in the right AWS region and create a new queue. We'll give it a name and set the configuration details that'll apply to all messages that will be added to the queue. Here is where you can set any message delays or maximum life spans you need. Click create queue. The details tab in the lower pane displays important information about our queue like it's URL and ARN. From the permissions tab we could allow or deny queue access to other users.

Click on the add a permission button and enter AWS account numbers in the principal box, then select the actions you'd like updated from the pull down menu. We'll cancel that for now and go back to the queue menu. As you might have noticed while we were creating the queue, a queue can be given a re-drive policy to redirect undelivered messages to a dead letter queue. We're not interested in that either right now. Let's create a message for our queue. Click on queue actions and select send a message. You could simply type your message in the text box and click send message. Alternatively you could also click on the messages attributes tab and give the message a title, set the message type as string, number, binary, or custom type and enter the value. We'll pretend that we're passing the number 50 to an application that will say, set the online price of an item we're selling.

Click add attribute, and if there are no more attributes we'd like to add to this message, create message. Now to view all the messages currently available to the queue, click queue actions and then view/delete messages. Click start polling for existing messages. The yellow progress bar at the bottom of the view/delete window will turn green once the 30 second polling is completed. Bear in mind that messages in this queue will not be available to other applications until our console stops polling. To delete a message, you can select it and click the delete one message button on the bottom right. You could also purge all the messages within a selected queue by clicking on purge queue. Obviously clicking on delete queue will have a predictable result. Now as we promised earlier, we'll very briefly demonstrate manipulating SQS programmatically. We'll quickly load up a local machine with PHP, Apache 2 and a few other small utilities like wget and unzip.

Then we'll use wget to download the latest version of the AWS PHP SDK from GitHub. We'll then unzip the package and use ls to take a look at what we've got, noting in particular the AWS autoloader.php file in the installation's root directory. Now let's go to Apache's /var/www/html directory and create a PHP file called createqueue.php. I'll simply paste the code inside, but we should take a close look at it. First, note the require line pointing to the local filesystem location of the AWS autoloader.php file. We're going to use the SDK resource's SQS client and credentials, and populate the credentials variable with my AWS access key ID, and secret access key. By the way, by the time you see this video I will have deleted these keys, so don't try anything.

Finally, note that I've set our region to US-East-1. Let's save the file using ctrl x. Now we'll load the file in a browser to run the SQS request, which seems to have been successful.

About the Author
David Clinton
Linux SysAdmin
Learning Paths

David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.

Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.

Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.

His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.