I had quite a big challenge trying to setup Laravel with Elastic Beanstalk EC2 Instances and I tried my best to look for resources explaining the steps in detail but all I found was cluttered information in the internet, so I spent a long time trying and debugging until I got it working at the end 🙌. Therefore, I decided to write this article hoping it may help anyone who might encounter the same struggle I had to save him some time or at least, to be a reference for my self in the future.
In this case, you need to set a cron job that runs each minute and checks these tasks of which having the deadline < x minutes, and if this condition is true, then you notify the user.
This is in short how the CRON job works and how its syntax is constructed, I think this is enough to grasp the basics and if you are looking for more details, then you can check this nice article: https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
One of the solutions that you can do is to use custom script for only running the CRON jobs from the leader_only in aws such as the this example shown by aws here: https://github.com/awsdocs/elastic-beanstalk-samples/blob/master/configuration-files/aws-provided/instance-configuration/cron-leaderonly-linux.config.