Working with SQS queues on LocalStack
# Working with SQS queues on LocalStack
If you develop your backend application that talks to an SQS queue, you would want to test your code locally before deploying it to the cloud. That's where LocalStack comes in. It's an amazing piece of software allowing you to run your SQS queues locally so you can debug and test your software. In this article, you'll learn how to work with your SQS queues locally.
# Start LocalStack
There are several ways to install LocalStack. The easiest way is to start it from Commandeer by simply downloading Commandeer, going to the LocalStack section, and clicking
Start All. If you already have a LocalStack docker container running, you can select your container from LocalStack settings.
# Create Queue
Navigate to SQS -> Dashboard and select
Create Queue. Type in the name of your queue and click
save. Voila, your queue is created and you should see your newly created queue in the list.
Entering the name of a new SQS queue
When developing your applications you might want to create your queue programmatically using IAC tools like Terraform, Ansible, or Serverless. You can see the queues you created using IAC in Commandeer too. Just hit the refresh button on the dashboard to refresh the list of queues.
# Add Messages
Now that we have our queue created, let's add a message to it. Click on the queue, then click
Add Message. Type in your message content in JSON or Plan Text and hit
Add. Your message is now added to your queue and the count of messages is increased by one.
Adding a message to the queue
Power trick: use a context menu to create messages. Just right click on the queue and choose
Add Message from the context menu.
While you're building your application, sending messages to a queue is usually done by the application itself. You can run your application or run a unit test that queues a message and see the content of your message in Commandeer.
# Viewing Messages
Once the message is in the queue, click
View Messages to see your messages. It comes quite handy when you have several messages queued that you want to see.
Viewing the created SQS message in the queue
# Refreshing Messages
You can also refresh the messages in the queue. Click on the refresh button in the top right so you can see newly created messages. It's also useful when you want to see the messages created outside of Commandeer.
LocalStack makes it easy to develop your applications locally. Especially when it comes to SQS. You can stand up LocalStack and start testing your SQS logic in minutes. Commandeer helps you visually see your SQS queues and messages from a well thought out GUI. Go ahead and give Commandeer a shot for your project.