I am using a Laravel 8 application on elastic beanstalk on AWS.
I am using the configuration as the link below specified, but with with some slight modifications in order to get the cron to work in my case (I think the answer is outdated) How do I setup and use Laravel Scheduling on AWS Elastic Beanstalk?
My cronjob.config file:
files:
"/etc/cron.d/schedule_run":
mode: "000644"
owner: root
group: root
content: |
* * * * * root . /opt/elasticbeanstalk/deployment/env && /usr/bin/php
/var/www/html/artisan schedule:run 1>> /dev/null 2>&1
commands:
remove_old_cron:
command: "rm -f /etc/cron.d/*.bak"
This runs well and I can test it corresponds to whatever interval that I choose on the laravel scheduler.
However, I ran into another issue. It seems that the RDS is denying the connection to the database. For context, this exact same environment set up works perfectly anytime except for when it is running the cron job. I also checked out the /opt/elasticbeanstalk/deployment/env file using eb ssh and it seems to match and is correct as well.
I set up a logs to help narrow down the error and I am getting the below:
SQLSTATE[HY000] [1045] Access denied for user '[CORRECT DB USER NAME HERE]'@'[Some Random IP ADRESS]' (using password: YES) (SQL: select * from
users
whereusers
where
I have tried enabling all inbound and outbound traffic from all IPs in the VPC connected to the RDS Database and still did not work.
I would appreciate any help!