Queue and other other background process on AWS Elastic Beanstalk
Elastic Beanstalk instances (and the queue workers running on them) are **ephemeral**, so they can be terminated during deployments, auto-scaling, or rebuilds. The key point is that **SQS is durable**, so messages are not destroyed when instances go away. If a worker crashes mid-job, the message simply becomes visible again after the visibility timeout and another worker can process it. The production-grade approach is to use **two EB environments**: a **Web** environment that serves requests and dispatches jobs, and a **Worker** environment that runs `php artisan queue:work` and consumes from SQS. As long as the **SQS visibility timeout is longer than the maximum job execution time**, deployments and scaling are safe, and “lost jobs” are usually caused by misconfiguration rather than SQS itself.
Bibek Shrestha
Full-stack Developer