简体   繁体   English

使用rds db实例在aws弹性beanstalk中托管laravel应用程序

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

I have successfully completed deploying my application on elastic beanstalk. 我已成功完成在弹性beanstalk上部署我的应用程序。 But when I call the URL it shows (I have exported my table to RDS DB instance) 但是,当我调用它显示的URL时(我已将我的表导出到RDS数据库实例)

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) Connector.php第47行中的ErrorException:SQLSTATE [HY000] [2002]连接超时(查看:/var/app/current/local/resources/views/themes/default1/client/cart.blade.php)

My database.php configuration is: 我的database.php配置是:

'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. 谢谢。

1) You may provide the port using the "port"-key in config: 1)您可以在config中使用“port”-key提供端口:

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

2) Check RDS Security groups, or - as most probably you're using RDS inside a VPC: 2)检查RDS安全组,或者 - 很可能你在VPC中使用RDS:

3) Check VPC Security groups. 3)检查VPC安全组。 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. 将VPC安全组附加到您的RDS实例,并将这些VPC安全组中的IP /您的帐户(不良做法)/您的实例或扩展组列入白名单。 Remember: If you use RDS inside VPC, it's the VPC Security group that's important for RDS! 记住:如果你在VPC中使用RDS,那么对于RDS来说重要的是VPC安全组!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM