Hosting laravel app in aws elastic beanstalk with rds db instance
I have successfully completed deploying my application on a resilient beanstalk. But when I call the url it shows (I exported my table to an RDS DB instance)
ErrorException at line Connector.php 47: SQLSTATE [HY000] [2002] Connection timed out (view: /var/app/current/local/resources/views/themes/default1/client/cart.blade.php)
My database.php config:
'mysql' => [
'driver' => 'mysql',
'host' => 'rds.cvp31y7ebg1x.us-west-2.rds.amazonaws.com:3306',
'database' => 'rdsdb',
'username' =>'rdsuser',
'password' => '******',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
Please help me understand this issue.
Thank.
source to share
1) You can provide a port using the "port" -key in config:
'port' => env('DB_PORT', '3306'),
2) Check your RDS security groups or maybe you are using RDS inside the VPC:
3) Check the VPC security groups. Attach VPC security groups to your RDS instance and configure your IP / your account (bad practice) / your instance or scaling group in those VPC security groups. Remember, if you are using RDS inside a VPC, this is a VPC Security group important to RDS!
source to share