Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hosting a laravel application in aws elastic beanstalk with rds db instance

I have successfully completed deploying my application on elastic beanstalk. But when I call the URL it shows (I have exported my table to RDS DB instance)

ErrorException in Connector.php line 47: SQLSTATE[HY000] [2002] Connection timed out (View: /var/app/current/local/resources/views/themes/default1/client/cart.blade.php)

My database.php configuration is:

'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 to figure out this problem.

Thanks.

like image 665
Vijay Sebastian Avatar asked Oct 15 '25 15:10

Vijay Sebastian


1 Answers

1) You may provide the port using the "port"-key in config:

'port' => env('DB_PORT', '3306'),

2) Check RDS Security groups, or - as most probably you're using RDS inside a VPC:

3) Check VPC Security groups. Attach VPC security groups to your RDS instance and whitelist your IP / your account (bad practice) / your instance or scaling group in these VPC security groups. Remember: If you use RDS inside VPC, it's the VPC Security group that's important for RDS!

like image 113
Huggy Avatar answered Oct 18 '25 06:10

Huggy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!