2014-09-12 19:13



I am on AWS with a lamp stack connecting to RDS.
I am able to connect from MySQL Workbench using SSH to RDS through amazons security groups.
But ... now that i need to connect from the outside world using PHP, I seem to be having some issues.

Normally i would connect to RDS using sqli like this:

$dbName = "";
$dbTable = "mytable";
$dbUser = "myusername";
$dbPass = "xxxxxxx";

But since the new instance is on a VPC on RDS public accessibility is not available.

I changed $dbName = '' which is the public ip of my EC2 instance, but i get an error: mysqli_real_connect(): (HY000/2005): Unknown MySQL server host ''

I am following this guide but seem to be unsuccessful at connecting.

I think I am not doing this part correctly

Create a second VPC security group (for example, "sg-dbsrv1") and create a new rule by specifying the VPC security group you created in step 1 ("sg-appsrv1") as the source.

Any help would be very appreciated, thank you.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongxiezhi0590 dongxiezhi0590 7年前

    In the AWS console you have to either append your IP to the existing security group or create another security group with your IP and add that group to your instance.

    RDS instances are not accessible except by hostname (especially if you're running Multi-AZ).

    点赞 评论 复制链接分享