Why do I get a SQLSTATE[HY000]  Connection refused error when running an artisan command in my EC2 instance?
I have a Laravel web app set up on Elastic Beanstalk and it can connect to the RDS database just fine. I have the environment variables set up through the configuration setting in EB. When I ssh into the EC2 instance and run a custom artisan command that queries the database like "sudo php artisan check-companies", I get the error SQLSTATE[HY000]  Connection refused (SQL: the query)". What could be causing this error? Here are a few things to note and what I’ve tried.
I have workers that run the same artisan command every day and it works.
I’m able to connect to the Aurora Cluster from MYSQL command line utility and run queries when I ssh into the instance.