title: Unable to connect to AWS RDS MySQL from php
body: <p>I am new to AWS and have set up a mysql RDS instance.</p>
  
  <p>I am able to connect from my laptop using MySQLWorkbench but when I try to connect with the following code from one of my servers (not an aws server) I get the following error:</p>
  
  <blockquote>
    <p>Warning: mysqli::mysqli(): (HY000/2002): Connection timed out in /home/asmserverco/public_html/sms/login.php on line 28
    Connection failed: Connection timed out</p>
  </blockquote>
  
  <p>Here is the php connection code:</p>
  
  <pre class="lang-html prettyprint-override"><code>$servername = "****.us-west-2.rds.amazonaws.com";
  $username = "awsasm";
  $password = "****";
  $dbname = "sms";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  } 
  </code></pre>
  
  
  
  <p>I have set all traffic on the instance's security group to be allowed from any IP.</p>
  
  <p>why can I connect from my laptop but not my web sever?</p>