Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jjosephs's avatar

How I get Queues to work with AWS Elastic Beanstalk Worker Tiers?

So I got the Queue system to work perfectly on the web tier. Architecturally I know the worker tier is meant to do the backend queue tasks so even though a regular web tier works, I want to get it up and running in a worker environment as well.

SQS seems to POST to a user-defined url for the worker tier which I assume is all the queue commands.

How do I get my Laravel App to run in the Worker Tier Environment? If I needed to setup a route to catch the post data, how do I then get Laravel to execute this job?

0 likes
15 replies
sammcafee's avatar

I have the same problem. It'd be great if someone who knows how the SQS driver works could chime in with a hint.

psteenbergen's avatar

This would be awesome if there is a series about AWS of setting up of: Web tier + Worker Tier + S3 Storage + RDS. Then you have almost unlimited scalability of a web app with low pricing

1 like
wesmahler's avatar

I'm new to Laravel. But it seems like you'd have to get this function to be called somehow:

https://github.com/laravel/framework/blob/5.2/src/Illuminate/Queue/Worker.php#L198

framework/src/Illuminate/Queue/Worker.php public function process($connection, Job $job, $maxTries = 0, $delay = 0) { }

Pass $connection and Job $job.

$job could probably be looked up by the SQS Request Headers when Elastic Beanstalk's Workers Environment pings your EC2 server. It'll pass over everything related to the message, there is likely a job_id in it. We've use the workers environment before, but I've never used it on Laravel.

Then just figure out how to pass over the $connection.

miho's avatar

Anybody got this issue working? Would love to use the AWS Elastic Beanstalk worker environment for handling my SQS based queue.

josemf's avatar

Would love to ear about this.

Thanks!

dusterio's avatar

Ok guys, I managed to get it up and running - both scheduled tasks and queued jobs. Same link above :)

morphers's avatar

Would love to get this to work with spot fleets!

GhaithAli's avatar

would be great to have a series about AWS worker and how to set it up with Laravel.

dusterio's avatar

@GhaithAli maybe I'll make a free video on YouTube. the package I made a year ago seems to be the most popular package for this purpose currently :)

1 like
GhaithAli's avatar

@dusterio That would be great. Would appreciate if you link the video here when done.

Thanks.

GhaithAli's avatar

@dusterio I just installed your package and it seems pretty straight forward. One question I have though. Should I define the routes in my web.php also? or how can I work with the data posted back to me from the SQS?

I am doing something like this now in the web.php:

Route::post('/worker/queue',['uses'=>'WorkerController@callWorker']);

Thanks again.

Please or to participate in this conversation.