SQS Queues in multiple environments with Laravel

tips Jul 10, 2025

If you're reading this you're probably looking for answers to the same problem I had: Your app uses multiple queues with different names, and you need to figure out the right way to configure your app so it resolves the queue names correctly AND it doesn't break your local setup.

TLDR;

Name your queues like this:

[queue name]-[environment name]-[app name]

So if your app is named beehive and you have queues default, high, low you should have:

Dev environment

default-dev-beehive
high-dev-beehive
low-dev-beehive

Production

default-production-beehive
high-production-beehive
low-production-beehive

Environment variables

SQS_PREFIX: Your aws account url

SQS_SUFFIX: -[environment name]-[app name]

This setup will allow you to still call ->onQueue('high/low/etc') without having to have any custom SQS specific functionality.

Gotchas to look out for

SQS_PREFIX can't be played around with too much. If you try to do something like [acount id]/[app name]-[environment]- laravel will automatically add a trailing / so the path will be wrong.

Tags