jeudi 15 mai 2014

Débordement de pile - connexion à l'instance RDS via VPC de CE2 à l'aide de PHP - MySQL


I've been looking on stackoverflow for quite some time, but I just can't seem to find a solution... Here's what my situation looks like:



  • EC2 instance in us-east-1b (running CentOS 6)

  • RDS instance in us-east-1b (multi-az is off)

  • Both EC2 and RDS instances are in the same VPC

  • Both EC2 and RDS instances use the same Security Group

  • I can login into RDS from EC2 through the terminal

  • I have my security group setup to allow ANY inbound IP address using TCP port 3306 (MySQL)

  • It was a long shot, but I've also disabled SELINUX on EC2


Now here's my problem:


I can't seem to figure out how to connect to RDS from EC2 through a simple PHP script. Whenever I try to connect, I get error code 13. Since EC2 can connect through the terminal, I'm guessing that's due to being in the same subnet; however, when I try to connect through PHP (I'm assuming at this point it's trying to connect with the EIP address) I get an error.


Weird thing is a I can connect to RDS though Sequel Pro (Mac equivalent to Navicat or phpMyAdmin), but not through EC2.


I'm starting to think it's not longer a security group issue, but a OS/PHP configuration on my EC2 instance that's completely slipped my mind.


Any thoughts? Thanks in advanced!




You can try to connect to your RDS instance using your internal subnet IP address. To find out which one is you internal IP address (from your VPC subnet) from your EC2 instance in the same subnet:


ping <your-rds-endpoint-without-3306>

Double check you use the right credentials.



I've been looking on stackoverflow for quite some time, but I just can't seem to find a solution... Here's what my situation looks like:



  • EC2 instance in us-east-1b (running CentOS 6)

  • RDS instance in us-east-1b (multi-az is off)

  • Both EC2 and RDS instances are in the same VPC

  • Both EC2 and RDS instances use the same Security Group

  • I can login into RDS from EC2 through the terminal

  • I have my security group setup to allow ANY inbound IP address using TCP port 3306 (MySQL)

  • It was a long shot, but I've also disabled SELINUX on EC2


Now here's my problem:


I can't seem to figure out how to connect to RDS from EC2 through a simple PHP script. Whenever I try to connect, I get error code 13. Since EC2 can connect through the terminal, I'm guessing that's due to being in the same subnet; however, when I try to connect through PHP (I'm assuming at this point it's trying to connect with the EIP address) I get an error.


Weird thing is a I can connect to RDS though Sequel Pro (Mac equivalent to Navicat or phpMyAdmin), but not through EC2.


I'm starting to think it's not longer a security group issue, but a OS/PHP configuration on my EC2 instance that's completely slipped my mind.


Any thoughts? Thanks in advanced!



You can try to connect to your RDS instance using your internal subnet IP address. To find out which one is you internal IP address (from your VPC subnet) from your EC2 instance in the same subnet:


ping <your-rds-endpoint-without-3306>

Double check you use the right credentials.


0 commentaires:

Enregistrer un commentaire